# cat /etc/timezone Europe/Athens
The easiest and recommended way to change the timezone :
# dpkg-reconfigure tzdata Current default time zone: 'Europe/Athens' Local time is now: Mon May 21 21:26:06 EEST 2012. Universal Time is now: Mon May 21 18:26:06 UTC 2012. #
All the zone data are at /usr/share/zoneinfo
# ls /usr/share/zoneinfo/ Africa Brazil Egypt GB Hongkong Jamaica Mideast Poland ROC US America Canada Eire GB-Eire HST Japan MST Portugal ROK UTC Antarctica CET EST GMT Iceland Kwajalein MST7MDT posix Singapore WET Arctic Chile EST5EDT GMT0 Indian Libya Navajo posixrules SystemV W-SU Asia CST6CDT Etc GMT-0 Iran localtime NZ PRC Turkey zone.tab Atlantic Cuba Europe GMT+0 iso3166.tab MET NZ-CHAT PST8PDT UCT Zulu Australia EET Factory Greenwich Israel Mexico Pacific right Universal
Actually /etc/localtime used to be just a link to the zone data file corresponding to the timezone set. On some systems it is still like that.
# ls -l /etc/localtime -rw-r--r-- 1 root root 2245 May 21 21:26 /etc/localtime -> /usr/share/zoneinfo/Europe/Athens
On the latest debian based systems /etc/localtime is a copy of the corresponding time zone file in /usr/share/zoneinfo. You could use diff to check :
# diff -s /etc/localtime /usr/share/zoneinfo/`cat /etc/timezone` Files /etc/localtime and /usr/share/zoneinfo/Europe/Athens are identical
So another way to change the local time is to link the appropriate time zone file to /etc/localtime :
# echo "America/Sao_Paulo" > /etc/timezone # rm /etc/localtime # ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime # date Mon May 21 16:19:53 BRT 2012or just copy the appropriate zone file to /etc/localtime :
# cp /usr/share/zoneinfo/Canada/Central /etc/localtime # date Mon May 21 14:26:32 CDT 2012
Of course dpkg-reconfigure is the right way to set the local time on debian systems
# dpkg-reconfigure tzdata Current default time zone: 'Europe/Athens' Local time is now: Mon May 21 22:28:31 EEST 2012. Universal Time is now: Mon May 21 19:28:31 UTC 2012.
Verify daylight savings change dates :
# zdump -v Europe/Athens | grep 2012 Europe/Athens Sun Mar 25 00:59:59 2012 UTC = Sun Mar 25 02:59:59 2012 EET isdst=0 gmtoff=7200 Europe/Athens Sun Mar 25 01:00:00 2012 UTC = Sun Mar 25 04:00:00 2012 EEST isdst=1 gmtoff=10800 Europe/Athens Sun Oct 28 00:59:59 2012 UTC = Sun Oct 28 03:59:59 2012 EEST isdst=1 gmtoff=10800 Europe/Athens Sun Oct 28 01:00:00 2012 UTC = Sun Oct 28 03:00:00 2012 EET isdst=0 gmtoff=7200 #
If you find some error for a zone you will have to get the source time zone files again, compile your timezone source file with zic and run dpkg-reconfigure tzdata.
The latest source zone file should be correct.
#mkdir tzdata #cd tzdata #apt-get source tzdata #cd tzdata-2012b #zic ./europe #dpkg-reconfigure tzdata
If the time zone source file is not correct or you just came up with your own dates and rules for daylight changes or your own time zone you will have to edit the time zone source and then compile it with zic and run dpkg-reconfigure tzdata.
Debian Wiki - Time Zone Changes
Obsolete yet interesting Time information
Linux Time -- time zone changes linux debian ubuntu