YouTube Icon

Code Playground.

How To Set or Change Timezone on Ubuntu 18.04

CFG

How To Set or Change Timezone on Ubuntu 18.04

On Ubuntu, the framework's timezone is set during the introduce, yet it very well may be effortlessly changed sometime in the not too distant future. 

Utilizing the right timezone is significant for some, frameworks related errands and cycles. For instance, the cron daemon utilizes the framework's timezone for executing cron occupations, and the timestamps in the log documents depend on the equivalent timezone. 

This instructional exercise exhibits how to set or change the timezone on Ubuntu 18.04 and past variants from the order line, or through the GUI. Similar guidelines apply for any Ubuntu-based conveyance, including Kubuntu, Linux Mint, and Elementary OS. 

Prerequisites

You'll should be signed in as root or client with sudo advantages to change the framework's timezone. 

Checking the Current Timezone

In Ubuntu and most other Linux circulations, we can utilize the timedatectl order to show and set the current framework's time and timezone. 

timedatectl

As should be obvious in the yield underneath, the timezone is set to UTC: 

       Local time: Wed 2019-01-23 22:45:47 UTC
                  Universal time: Wed 2019-01-23 22:45:47 UTC
                        RTC time: Wed 2019-01-23 22:45:48
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

The framework timezone is arranged by symlinking/and so forth/localtime to a paired timezone identifier in the/usr/share/zoneinfo catalog. Along these lines, another alternative is show the way the symlink focuses to utilizing the ls order : 

ls -l /etc/localtime
lrwxrwxrwx 1 root root 27 Dec 10 12:59 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC

On the other hand, you can likewise check the current framework's timezone by showing the substance of the/and so forth/timezone record. 

cat /etc/timezone
Etc/UTC

Changing the Timezone Using the timedatectl Command 

Prior to changing the timezone, you'll have to discover the long name for the timezone you need to utilize. The timezone naming show normally utilizes a "Locale/City" design. 

To list all accessible time regions, you can either list the documents in the/usr/share/zoneinfo registry or utilize the timedatectl order. 

timedatectl list-timezones
...
Europe/Oslo
Europe/Paris
Europe/Podgorica
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
...

When you recognize which time region is precise to your area, run the accompanying order as sudo client: 

sudo timedatectl set-timezone your_time_zone

For instance, to change the framework's timezone to Europe/Rome: 

sudo timedatectl set-timezone Europe/Rome

Run the timedatectl order to confirm the changes: 

timedatectl
                      Local time: Thu 2019-01-24 00:27:43 CET
                  Universal time: Wed 2019-01-23 23:27:43 UTC
                        RTC time: Wed 2019-01-23 23:27:44
                       Time zone: Europe/Rome (CET, +0100)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Changing the Timezone by Reconfiguring tzdata

In the event that you are running a more established variant of Ubuntu , and the timedatectl order is absent on your framework, you can change the timezone by reconfiguring tzdata. 

Distinguish the timezone you need to arrange. 

Spare the new timezone name to/and so forth/timezone record utilizing the accompanying tee order : 

echo "Europe/Rome" | sudo tee /etc/timezone
Europe/Rome

Run the accompanying order to change the framework's timezone: 

sudo dpkg-reconfigure --frontend noninteractive tzdata
Current default time zone: 'Europe/Rome'
Local time is now:      Thu Jan 24 00:40:48 CET 2019.
Universal Time is now:  Wed Jan 23 23:40:48 UTC 2019.

Changing the Timezone Using the GUI

In the event that the order line isn't your thing, you can change the current framework's timezone through the GUI. 

Open the framework settings window by tapping on the Settings symbol, as appeared in the picture beneath: 

In the framework settings window click on the Date and Time tab, turn the Automatic Time Zone to OFF and tap on the Time Zone box: 

On the off chance that the Automatic Time Zone set to ON and you have an Internet association, the time region should be naturally set by your area. 

To choose the new timezone, you can either tap on the guide or quest for a time region through the pursuit bar. 

When done, click on × to close the window. 

Conclusion

In this guide, we have told you the best way to change your Ubuntu framework's timezone. 

Don't hesitate to leave a remark on the off chance that you have any inquiries.




CFG