Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

TZ may be set like this:

   TZ=:Europe/Copenhagen
Replace Europe/Copenhagen with the appropriate entry from the list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Usually, /etc/localtime is a symlink, as on my laptop:

  /etc/localtime -> /usr/share/zoneinfo/Europe/Copenhagen
so TZ=:/etc/localtime has the same result.

You can demonstrate that it takes account of changes to timezones:

Normal time for London:

  $ TZ=:Europe/London date -d '1995-12-30 12:00 UTC' -R
  Sat, 30 Dec 1995 12:00:00 +0000
British Summer Time:

  $ TZ=:Europe/London date -d '1995-06-30 12:00 UTC' -R
  Fri, 30 Jun 1995 13:00:00 +0100
'Double British Summer Time', used for a period during World War 2:

  $ TZ=:Europe/London date -d '1945-06-30 12:00 UTC' -R
  Sat, 30 Jun 1945 14:00:00 +0200
Before London's time was standardized to Greenwich:

  $ TZ=:Europe/London date -d '1845-06-30 12:00 UTC' -R
  Mon, 30 Jun 1845 11:58:45 -0001


wait, so when I did `echo $TZ`, to check, and got `Europe/Amsterdam` that means it's already properly and I did't need to set it to `:/etc/localtime`?

this is not a part of Linux I'm very familiar with


Thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: