How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server

Setting the correct date, time, time zone and synchronization are the first basic steps that you should perform when provisioning your Ubuntu 22.04 server for the first time.
An accurate time on your Linux machine ensures the smooth operation of your server. For instance, if you have some cron jobs, they need to run accurately on the specified timing. Also, the correct date makes sure that logs are recorded in the right order on your machine.
Some applications also rely on the system date to check for updates. So, if your system date/time goes out of sync, your server will be prone to errors and a lot of hard-to-resolve issues.
Time synchronization is enabled by default on Ubuntu 22.04 but it is good to double check that everything is working as expected. Also, you need to change the time zone per your requirement.
The purpose of this guide is to show you how to check, enable and disable date/time synchronization on your Ubuntu 22.04 server.

Pre-requisites

  • A Linux server running Ubuntu 22.04 LTS Jammy Jellyfish
  • A non-root user with sudo privileges

Step 1: Checking your local Ubuntu 22.04 time settings

You can check your Ubuntu 22.04 server local time, time zone and synchronization status by typing the command below on a terminal window. You don’t require to prefix the command with sudo:

 

$ timedatectl

The command above will output the information below:
How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server

As you can see from the above screen, the server’s Time zone is CDT and the “system clock synchronized” status is already set to “yes”

Step 2: Checking the list of available time zones on Ubuntu 22.04 server

In order for date/time synchronization to work well on your Ubuntu 22.04 server, you need to set the proper time zone.
First, check the available time zones on your Ubuntu 22.04 server by running the command below:

$ timedatectl list-timezones

How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server
The command will display all available time zones on your server. This is a very long list. However, you can use the grep command to limit the list to a specific area.
For instance to see a list of all America time zones, type the command below:

$ timedatectl list-timezones | grep -i america

Output
How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server
With a narrowed list like the one shown above, you can choose the right time zone for your server.

Step 3: Changing the time zone on Ubuntu 22.04 server

Changing the time zone is very simple on Ubuntu 22.04 server. For instance,to change our server’s time zone to “America/New_York” from our list above, we will use the command below:

$ sudo timedatectl set-timezone America/New_York

How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server
We can run the timedatectl command to ensure that the changes were effected successfully.
Output
How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server

Step 4: Enabling/Disabling time synchronization

Ubuntu 22.04 utilizes the NTP (Network Time Protocol) server daemon, which connects to a pool of Network Time Protocol servers to get constant and accurate time updates.

From the image above, we can see the NTP service status is already set to “active”. However, you can activate it on your system by running the command below:

$ sudo timedatectl set-ntp on

You can deactivate the NTP service by typing the command below

$ sudo timedatectl set-ntp off

To confirm the changes, run the timedatectl command.

Output

How to Setup the Date and Timezone on an Ubuntu 22.04 VPS or Dedicated Server

Conclusion

In this guide, we showed you the view of your system date, time and list all the available time zones. We have also taken you through the steps of changing your Ubuntu 22.04 server time zone as well as enabling/disabling time synchronization on the NTP server daemon. With the above information, you will be able to run your VPS without any problems when it comes to accurate date and time on your server.

How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server

Brief Description FTP is usually insecure exposing clear-text passwords, userna
2 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How To Set up a VSFTPD Server on an Ubuntu 16.04 VPS or Dedicated Server

Brief Description FTP data is usually insecure since information (usernames, pa
2 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to use phpMyAdmin to develop a website (without MySQL experience)

Brief description A web developer who is not well versed into coding websites f
2 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Install MySQL on a Windows Web Server Running Apache

This tutorial will show you how to install the MySQL database on a Windows serve
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.