How to Configure Timezone on Ubuntu 20.04 | 18.04

This brief tutorial shows students and new users how to set or configure timezone on Ubuntu 20.04 | 18.04.

During Ubuntu installation (Desktop/Server), one of the tasks that you’re provided is to set the system timezone. The timezone you entered will be the system default timezone.

However, at a later date, if you decide to update the system’s timezone you can do it from the system settings and the steps below show you how to do it.

Making sure Ubuntu dates and times are right is very important to system related tasks and processes such as cron daemon and time-sensitive jobs..

When you’re ready to configure Ubuntu timezone, follow the steps below:You’ll need to be logon as the system administrator to change its timezone… Regular users can use sudo privileges to make this change.

Option 1: Set Timezone (Command line)

Since Ubuntu servers are mostly administered from the command line, let’s start with that.

Before changing the system timezone, you may want to verify or check the current timezone is configured on the system.

To do that run the commands below:

timedatectl

You should see an output like the one below:

local time: Fri 2019-01-25 10:14:22 CST
                  Universal time: Fri 2019-01-25 16:14:22 UTC
                        RTC time: Fri 2019-01-25 16:14:22
                       Time zone: America/Chicago (CST, -0600)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

That above command will print out what your current timezone is. From the print out above, it is set to America/Chicago

Ubuntu system timezone is symlinked from /etc/localtime directory to the binary identifier in the /usr/share/zoneinfo directory… you can run the commands below to see how it’s symlinking.

ls -l /etc/localtime

Now, if you want to change the timezone to something other than what it’s currently set to, you will need to know the long name of the timezone you want to change to.

To find out, run the commands below to list all the timezones on the system…

timedatectl list-timezones

You should see similar output with list of time zones:

.....
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
....

Find the timezone from the list you want to use.. Then run the commands below to change to it.. For example if you wish to change the timezone to Accra in Africa, run the commands below:

sudo timedatectl set-timezone Africa/Accra

Now run the timedatectl command again, and this time it should show the updated timezone

  Local time: Fri 2019-01-25 16:23:55 GMT
                  Universal time: Fri 2019-01-25 16:23:55 UTC
                        RTC time: Fri 2019-01-25 16:23:55
                       Time zone: Africa/Accra (GMT, +0000)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

That’s it! This is how to change the system timezone using the command line…

If you’re running an older version of Ubuntu, then you may want to use the tzdate command to change the system’s timezone… The timedatectl command may not be available on all systems… so use the tzdate command instead..

First, save the new timezone you want to use into the /etc/timezone file… For Africa/Accra, run the commands below:

echo "Africa/Accra" | sudo tee /etc/timezone

Then run the commands below to save the change….

sudo dpkg-reconfigure --frontend noninteractive tzdata

That should do it!

Option 2: Set Timezone on Desktop GUI

For those who want to change the desktop timezone, they can follow the step below:

Logon to the desktop, then click on System Settings from the system menu..

ubuntu dns change

Then navigate to Details –> Date & Time then switch Automatic Time Zone button OFF

Ubuntu timezone

After that, click the Time Zone and choose the city of location on the map

If the Automatic Time Zone set to ON, and you have an Internet connection, the time zone should be automatically set according to your location…. However, this might not be accurate..

When you’re done, X out and close the windows.

This is how to set or change Ubuntu Timezone on desktop and server.

Conclusion:

This post showed you how to configure Ubuntu system timezone. If you find any error above, please use the comment form below to report.

Thanks,

You may also like the post below:

Leave a Reply

Your email address will not be published. Required fields are marked *

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