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

How can we automatically set the system default timezone in Linux using the Internet? As I see it, NTP servers can update only time, but not timezone. Is there any server that can change the timezone?

share|improve this question
Are you saying like the time zone change from day light savings to standard time? – slm Sep 12 '13 at 2:26
Here, there are two things. 1.if there is change in country. 2. second if there is change in day light savings. – Embedded Programmer Sep 12 '13 at 2:54
ntp servers handle changes in daylight savings time automatically. I don't know of any servers that detect your location and update your timezone automatically (like a cell phone does). – drs Sep 12 '13 at 3:32
@drs More accurately, NTP doesn't care about the time zone at all. NTP time is UTC, plain and simple, and time zone conversion is for the client to perform. A specific NTP client might do timezone conversion, or it might not, but since most *nix systems have the system clock set to UTC anyway, it shouldn't need to. – Michael Kjörling Sep 12 '13 at 9:59

I wrote a program a while ago that does this: tzupdate.

You can see what it would set your timezone to (without actually setting it) by running tzupdate -p:

$ tzupdate -p

You can set it for real by running tzupdate as root.

$ sudo tzupdate
$ date
Thu 12 Sep 05:52:22 CEST 2013

This works by:

  • Geolocating your current IP
  • Getting the time zone for that location
  • Updating the symlink at /etc/localtime to point to the zoneinfo file for that timezone
share|improve this answer

Most linux systems that use a package manager can pull updates from the "tzdata" package.

share|improve this answer

It's not clear what you mean by "timezone update".

Unix and Linux keep time as the number of seconds since January 1, 1970, 00:00 UTC. The Unix system clock is therefore timezone independent. Timezones do not exist in the Linux kernel; it is only when a userspace application displays the time that the number of seconds since 1970 is interpreted using a timezone. Usually, this interpretation is done through C library functions. The timezone is selected by the TZ environment variable. The timezone definitions (which consist of a timezone name, offset from UTC, dates when daylight saving time is in effect, and the offsets during DST) are part of GNU libc, and are usually included in Linux distributions as a "tzdata" package. Therefore, updating the timezone definitions is a matter of running apt-get upgrade, yum update, or some similar operation.

Note that some software, such as Java, have their own timezone definition files, which have to be updated separately.

NTP keeps track of the number of seconds since January 1, 1900, UTC. Therefore, NTP, like the Unix kernel, has no concept of timezones.

share|improve this answer
Timezone update, we can see "date" command will print time and date according to /etc/localtime timezone, we can change timezone manually by creating symbolic link of /usr/share/zoneinfo/America/Los_Angeles. but this is manual way of doing. I want, it should automatically update time zone of country where i am, rather than doing manually. – Embedded Programmer Sep 12 '13 at 8:47

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.