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…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago