Categories: Development

Checking and changing system time in Ubuntu

Most of the time a freshly installed server will automatically set its timezone to be locally orientated, this can be easily changed for user preference.

Finding your Ubuntu systems time can be done with

timedatectl

This will return formated data like

Local time: Fri 2020-01-31 23:41:09 AEDT
Universal time: Fri 2020-01-31 12:41:09 UTC
RTC time: Fri 2020-01-31 12:41:09
Time zone: Australia/Melbourne (AEDT, +1100)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no

You can see the time and date, the time zone and UTC time and date.

Changing this time require you to know the timezone for the new setting, you can find all the timezones by using:

timedatectl list-timezones | grep -i [zone]

Or to be more specific you can specify the parent zone:

timedatectl list-timezones | grep -i America

Changing the timezone is done by unlinking the local time setting

sudo unlink /etc/localtime

Then adding your zone where the X is:

sudo ln -s /usr/share/zoneinfo/X /etc/localtime

like:

sudo ln -s /usr/share/zoneinfo/America/Chicago
 /etc/localtime

Run timedatectl again to confirm the timezone and time has changed.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago