Beta 42

Research and Development

Menu

Configure Time Zone

This setup was made having Ubuntu 19.10 and 18.04 in mind, but should work on other Debian derivates as well.

On Ubuntu, the system’s timezone is set during the install, but it can be easily changed at a later time.

Using the correct timezone is important for many systems related tasks and processes. For example, the cron daemon uses the system’s timezone for executing cron jobs, and the timestamps in the log files are based on the same timezone.

Checking the Current Timezone

In Ubuntu and most other Linux distributions, we can use the timedatectl command to display and set the current system’s time and timezone.

timedatectl

Example output:

               Local time: Fri 2020-04-17 09:35:17 BST
           Universal time: Fri 2020-04-17 08:35:17 UTC
                 RTC time: Fri 2020-04-17 08:35:17
                Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Change the Timezone

Before changing the timezone, you’ll need to find out the long name for the timezone you want to use. The timezone naming convention usually uses a Region/City format.

To list all available time zones, you can either list the files in the /usr/share/zoneinfo directory or use the timedatectl command.

timedatectl list-timezones

Example output:

...
Europe/Oslo
Europe/Paris
Europe/Podgorica
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
...

Once you identify which time zone is accurate to your location, run the following command as sudo user:

sudo timedatectl set-timezone your_time_zone

For example, to change the system’s timezone to Europe/London:

sudo timedatectl set-timezone Europe/London

Run the timedatectl command to verify the changes:

timedatectl

Example output:

               Local time: Fri 2020-04-17 09:39:41 BST
           Universal time: Fri 2020-04-17 08:39:41 UTC
                 RTC time: Fri 2020-04-17 08:39:41
                Time zone: Europe/London (BST, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no