Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the best way to retrieve the current time zones of a number of countries, on a daily basis? (that would take into account DST changes, of course)

  • Reliably
  • If possible the Linux way (i.e. either using internal resources, or a Linux website API)

(I'm on Ubuntu 10.04)

share|improve this question
up vote 4 down vote accepted

If you just want the timezone, then timezones are stored in /usr/share/zoneinfo.

If you want to be able to retrieve the current time for a number of different cities or countries, then you can pull them from the Date and Time Gateway.

share|improve this answer

You can simply do something like this:

$ TZ=Europe/Moscow date
Thu Jun  9 08:34:46 MSD 2011
$ TZ=America/NewYork date
Thu Jun  9 04:34:48 America 2011

You can find the zone names in /usr/share/zoneinfo. Of course, this requires that the machine you run this on has the correct time set.

(You can't really get the time by country, because a lot of countries have more than one timezone.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.