The time zone as reported by date does not necessarily result in correct behavior when used for the TZ envariable. [thoth@maya thoth]$ date Sat Jun 10 14:16:37 EDT 2000 [thoth@maya thoth]$ date +%Z EDT [thoth@maya thoth]$ TZ=EDT date Sat Jun 10 18:16:47 EDT 2000 [thoth@maya thoth]$ TZ=Z date Sat Jun 10 18:16:58 2000 What is the TZ for EDT anyway?
This is expected behavior, unknown time zones (like TZ=Z above) use either UTC or the native system time w/o timezone modification. Here's what I see on a machine that keeps time in UTC, but is in timezone EST: bash$ date Sat Jan 6 14:23:03 EST 2001 bash$ TZ=yadda_yadda date Sat Jan 6 19:23:06 yadda_yadda 2001 bash$ TZ=UTC date Sat Jan 6 19:23:19 UTC 2001 bash$ TZ=Z date Sat Jan 6 19:23:28 2001
What is the TZ for EDT anyway?
Eastern Daylight Time, GMT-4, same as New York City.
[hammor@comstar3 hammor]$ date Sat Jan 6 21:28:11 GMT 2001 [hammor@comstar3 hammor]$ TZ=Eastern date Sat Jan 6 21:28:20 Eastern 2001 [hammor@comstar3 hammor]$ TZ=GMT-4 date Sun Jan 7 01:28:26 GMT 2001 Please provide sample command line to output the date in Eastern on a machine with a different /etc/localtime . Please provide documentation pointers to derive the proper values for the TZ environment variable for other time zones. Consider placing this documentation (or a reference to it) in the manual page for the date command.
Is there any way to get the date command to print out the proper value for the TZ environment variable?
TZ is perfectly documented in "info libc", search for TZ. There is no way that date can print out "proper" settings, as the problem is equivalent to defing "proper".