1 min read

How to check the timezone and update it

Etienne Marais

When you spin up a new virtual machine on the cloud, you might be confused when you try run a cronjob at a certain time and it doesn't. You might want to back up some data or to rotate logs but it runs later than you expected.

Check the timezone details on your ubuntu instance:

timedatectl status | grep "Time zone"

# Output
Time zone: Etc/UTC (UTC, +0000)

Ah, now it makes sense. I am UTC + 2.

Here is the full output:

timedatectl status

# Output
Local time: Wed 2018-01-24 18:09:34 UTC
    Universal time: Wed 2018-01-24 18:09:34 UTC
        RTC time: Wed 2018-01-24 18:09:34
        Time zone: Etc/UTC (UTC, +0000)
    Network time on: yes
NTP synchronized: yes
    RTC in local TZ: no

Update

Run and follow the on screen commands by selecting the option for you and pressing enter;

sudo dpkg-reconfigure tzdata

Option 1

Option 2

# Output Current default time zone: 'Africa/Johannesburg' Local time is now: Wed Jan 24 20:17:50 SAST 2018. Universal Time is now: Wed Jan 24 18:17:50 UTC 2018.