You are not logged in.

#1 2011-12-09 21:46:49

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,677
Website

strftime to display times in UTC [SOLVED]

I'm using tree to generate some lists but I would like to have the DTS to have times displayed in UTC, not my local time zone.

tree -DC -T "Heading" -H "title" --charset=utf8 --timefmt "%b %d %R" -o test.html

This gives the output times in 24 h notation but with my timezone offset.  I can't figure out how to get it to output with no offset, i.e. using UTC.

Last edited by graysky (2011-12-09 22:05:29)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2011-12-09 21:55:48

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: strftime to display times in UTC [SOLVED]

If tree really uses strftime, then it will honor the TZ environment var. Just prefix the command with TZ=UTC.

Offline

#3 2011-12-09 21:57:45

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: strftime to display times in UTC [SOLVED]

falconindy wrote:

If tree really uses strftime, then it will honor the TZ environment var. Just prefix the command with TZ=UTC.

This. It's also mentioned in the tree man page, under the ENVIRONMENT section..

Offline

#4 2011-12-09 22:05:19

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,677
Website

Re: strftime to display times in UTC [SOLVED]

Got it!  Have to export TZ=UTC for it to work.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB