During Ubuntu installation (Desktop/Server), one of the installation tasks is to set the system timezone. After the installation, you can always change it to something other than what was chosen during the initial setup.
This brief tutorial shows students and new users how to set or change Ubuntu timezone on desktop or server machines easily from the command line as well as from the desktop GUI app.
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: Changing Ubuntu Server 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 what the current timezone is configured on the system. To do that run the commands below:
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.
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: Changing Ubuntu 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.
Then navigate to Details –> Date & Time then switch Automatic Time Zone button OFF
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.
You may also like the post below: