How to check and Change timezone in Ubuntu

When you create Ubuntu server, by default timezone is of the same regions where host is located or predefined by the cloud service provider. If you need to check the timezone use following command.

$ timedatectl
               Local time: Sun 2021-06-27 11:09:28 CEST
           Universal time: Sun 2021-06-27 09:09:28 UTC 
                 RTC time: Sun 2021-06-27 09:09:29     
                Time zone: Europe/Paris (CEST, +0200)  
System clock synchronized: yes                         
              NTP service: active                      
          RTC in local TZ: no 

You can check the timezone using following command as well

$ cat /etc/timezone
Europe/Paris

Now let us check how to change the timezone. First you need long name of timezone and you can fetch it using following command

$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Algiers
Africa/Bissau
Africa/Cairo
Africa/Casablanca
.
.
Asia/Kolkata
.
.
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC
lines 298-348/348 (END

To change timezone, you need to run below command

$sudo timedatectl set-timezone your_time_zone

In current scenario, I need to change it to IST (Indian Standard Time). Here is the the output of current timezone after changing timezone

$ sudo timedatectl set-timezone Asia/Kolkata
$ timedatectl
               Local time: Sun 2021-06-27 14:46:44 IST
           Universal time: Sun 2021-06-27 09:16:44 UTC
                 RTC time: Sun 2021-06-27 09:16:45    
                Time zone: Asia/Kolkata (IST, +0530)  
System clock synchronized: yes                        
              NTP service: active                     
          RTC in local TZ: no 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.