This article provides a guide to setting the server time and server time zone settings using timedatectl.
Get Server Time
To check the current time on your Linux server, login to the console and run the following command:
timedatectl status
The response should be similar to the example below.
Set Server Time
To set the server time on your Linux server, login to the command line and run the following command:
timedatectl set-time [YYYY-MM-DD HH:MM:SS]
Using the pattern above, enter the desired date and time, with the units in descending order from longest to shortest (Year...Seconds).
Set Server Time Zone
To set the server time zone on your Linux server, run the following command:
timedatectl set-timezone "America/Chicago"
Using the pattern above, enter the desired time zone using either UTC or Tz database, with the time zone enclosed in quotes.