How do I change my timezone to UTC/GMT?
Matthew Martinez
Currently when I execute the date command from bash I get the following displayed
Thu May 17 12:21:00 IST 2012
Below is my timezone config based on executing dpkg-reconfigure tzdata
Current default time zone: 'Europe/Dublin' Local time is now: Thu May 17 12:32:52 IST 2012. Universal Time is now: Thu May 17 11:32:52 UTC 2012.
Any idea how I change from IST to UTC/GMT?
6 Answers
Any idea how I change from IST to GMT?
To switch to UTC, simply execute sudo dpkg-reconfigure tzdata, scroll to the bottom of the Continents list and select Etc or None of the above; in the second list, select UTC. If you prefer GMT instead of UTC, it's just above UTC in that list. :)
sudo timedatectl set-timezone UTCWill change your timezone to UTC system wide.
You can do timedatectl list-timezones to see all the available timezones.
excerpt from @MattJohnson's answer on SO
0Zones like
Etc/GMT+6are intentionally reversed for backwards compatibility with POSIX standards. See the comments in this file.You should almost never need to use these zones. Instead you should be using a fully named time zone like
America/New_YorkorEurope/Londonor whatever is appropriate for your location. Refer to the list here.
In the old Un*x style (SunOS, HPUX...), you can do:
ln -fs /usr/share/zoneinfo/UTC /etc/localtimeCheck the contents of /usr/share/zoneinfo to get the timezone you want/need.
For instance, Irish Summer Time (IST) can be defined as
-rw-r--r-- 1 root root 3661 Mar 13 22:18 /usr/share/zoneinfo/posix/Eireor
lrwxrwxrwx 1 root root 13 Mar 13 22:18 /usr/share/zoneinfo/Europe/Dublin -> ../posix/EireHowever, the most important is to use a proper clock reference and a ntp daemon (openntpd for instance), as timezone is only used for displaying/converting the time to strings, not to store it (whatever the timezone, difference to 01/01/1970 is everywhere the same on Earth).
1Updated for 14.04 to present
View Time and Date Status:
$ timedatectl status Local time: Sun 2018-07-29 15:26:03 BST Universal time: Sun 2018-07-29 14:26:03 UTC RTC time: Sun 2018-07-29 14:26:03 Time zone: Europe/London (BST, +0100) System clock synchronized: yes
systemd-timesyncd.service active: yes RTC in local TZ: noView List of Timezones:
Listed Timezones (425)
$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
...
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTCSet Timezone to UTC:
$ timedatectl set-timezone UTCView Time and Date Status:
$ timedatectl status Local time: Sun 2018-07-29 14:46:27 UTC Universal time: Sun 2018-07-29 14:46:27 UTC RTC time: Sun 2018-07-29 14:46:27 Time zone: UTC (UTC, +0000) System clock synchronized: yes
systemd-timesyncd.service active: yes RTC in local TZ: no* 4 Something like this?
$ date
Wed Jul 16 22:52:47 EDT 2014
$ cat /etc/timezone
America/New_York
$ sudo dpkg-reconfigure tzdata
$ service cron stop && service cron start In case you need this for only a single command, say, ls, use this:
TZ=UTC ls -l --full-time