On Linux, the command in charge is timedatectl. Run it with nothing after it and you see three things: the local time, the time zone in use and whether the clock is synchronised with the network. A wrong clock looks harmless and is not: it breaks certificates (“not valid yet”), misaligns logs, and makes cron jobs run at times you did not expect. The commands are yours, on your own server: support does not run them for you (see how far our support goes).
See what is set now
Run timedatectl. Look for the lines “Time zone”, “System clock synchronized: yes” and the active synchronisation service. A new VPS usually comes in UTC, the universal time, with no offset at all. That is not a fault: it is the most usual choice for servers.
Changing the time zone
| 1 |
List the zones and find yours. timedatectl list-timezones | grep -i city, replacing “city” with the name of your main city in English. The names always have the shape Region/City.
|
|
| 2 |
Set it: sudo timedatectl set-timezone Region/City, with the name you found. To go back to universal time: sudo timedatectl set-timezone UTC.
|
|
| 3 |
Confirm with timedatectl and with date.
|
|
| 4 |
Restart what depends on the time. Services that were already running may have kept the old zone. Restart cron (on Debian and Ubuntu, sudo systemctl restart cron) and your applications, or reboot the server.
|
|
Keeping the clock right
| 1 |
Check that synchronisation is on. In timedatectl, the synchronisation line should say “yes”. If not, switch it on with sudo timedatectl set-ntp true.
|
|
| 2 |
If no synchronisation service is installed. On Debian and Ubuntu, install systemd-timesyncd with sudo apt install systemd-timesyncd. On AlmaLinux and Rocky there is usually chrony already; check with chronyc tracking.
|
|
| 3 |
Check again after a minute. The first synchronisation can take a moment.
|
|
| Choice |
When it makes sense |
| Server on UTC |
The commonest and most predictable. The logs of several servers line up, and conversion to local time is done in the application. |
| Server on your local time |
Handy when it is a single server and whoever runs it reads the logs and cron schedules in their own time. Beware of clock changes, if your country has them. |
|
A certificate that is “not valid yet” is almost always the clock. If an HTTPS that worked yesterday throws a date error, start with date. See also common VPS and Cloud errors.
|
|
Does the server clock refuse to synchronise? Tell us the system and what timedatectl shows.
Open a support ticket
|
RECOMMENDED PRODUCT VPS server with root access Resources of your own, the OS you choose, reinstall whenever you like. from $8.39/mo (3-year plan, with coupon) See plans |