164

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?

muru
  • 207,970
dmckenna
  • 1,743

7 Answers7

209

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. :)

ish
  • 142,198
  • 2
    Yes! I wish this was enabled by default. – wberry Aug 22 '12 at 15:08
  • 1
    After I did what you wrote above, and changed the time zone, my server is still having the same wrong time, do I need to restart the system, or what? –  Oct 16 '12 at 17:50
  • 11
    In Ubuntu 14.04.1, Etc is None of the above. – f01 Jul 04 '16 at 13:51
  • 2
    From the command line in Ubuntu, the following link provides the trivial 1-line command: http://askubuntu.com/a/524362/182454 – Dan Nissenbaum Dec 15 '16 at 06:29
  • Simplicity! (KISS) Love it, Thanks! On a minimal Server install the other time Zones are not available, just UTC, so installing sudo apt install tzdata is a MUST! – EODCraft Staff Aug 27 '19 at 18:39
  • This changed Local time. But the universal time does not change. My website is using the universal time. – Hikaru Shindo Dec 20 '19 at 07:09
  • you saved my life. for new server developer click space on keyboard to choose . – Yogi Apr 14 '23 at 23:36
99
sudo timedatectl set-timezone UTC

Will 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

Zones like Etc/GMT+6 are 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_York or Europe/London or whatever is appropriate for your location. Refer to the list here.

abu_bua
  • 11,333
dkam
  • 1,109
  • 7
  • 5
  • For some reason this doesn't seem to do much on Ubuntu 24.04.5. Even though I see UTC when I run timedatectl without arguments, /etc/timezone and most applications including the clock in the top bar are unaffected. The answer above (sudo dpkg-reconfigure tzdata) works, however. – Vladimir Panteleev Feb 04 '25 at 12:18
14

In the old Un*x style (SunOS, HPUX...), you can do:

ln -fs /usr/share/zoneinfo/UTC /etc/localtime

Check 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/Eire

or

lrwxrwxrwx 1 root root 13 Mar 13 22:18 /usr/share/zoneinfo/Europe/Dublin -> ../posix/Eire

However, 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).

  • I can use this to change UTC to Asia/Kolkatta with.. sudo rm /etc/localtime (i had already this file so couldn't create symlink with next command, so i deleted it first), sudo ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime. I think this seems to be a general solution. – Ajeeb.K.P Feb 24 '16 at 08:53
12

Updated 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: no

View List of Timezones:
Listed Timezones (425)

$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
...
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC

Set Timezone to UTC:

$ timedatectl set-timezone UTC

View 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*
Broadsworde
  • 4,552
  • Hey, can you help me to set timezone UTC+06:00?? thanks – Md Alamin Mar 21 '19 at 03:35
  • I had a dig around, but set-timezone only allows you to set a timezone in the available list-timezones, you can't apply modifiers or offsets it seems. There may be another way to achieve setting UTC+06:00 but I couldn't find it... worth asking the forum in a new question. – Broadsworde Mar 21 '19 at 13:34
  • Hey I solved it, sudo timedatectl set-timezone Asia/Dhaka btw Thanks. – Md Alamin Mar 22 '19 at 03:19
  • 1
    I misunderstood your requirement... there are numerous timezones in the available list-timezones set that meet the UTC+06:00, I thought you were looking for a way of applying a non-geographic generic UTC offset. Glad you found what you were looking for. – Broadsworde Mar 22 '19 at 16:36
7

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
Kerem
  • 696
1

In case you need this for only a single command, say, ls, use this:

TZ=UTC ls -l --full-time
Christian Hujer
  • 2,512
  • 1
  • 17
  • 16
0

When I saw that VDS TZ is wrong......

// see current TZ
# date                        
Wed Sep 25 16:27:14 UTC 2024

// see the current Continent/Place

cat /etc/timezone

Etc/UTC

// find out our new position

timedatectl list-timezones |grep Moscow

Europe/Moscow

// you will not be able to make a mistake in new position by this way

timedatectl list-timezones |grep Moscow |xargs timedatectl set-timezone

// ensure that position changed

cat /etc/timezone

Europe/Moscow

// the date is displayed correctly

date

Wed Sep 25 19:31:45 MSK 2024