timedatectl shows wrong local time
this the output of my timedatectl command on a proxmox VM running on a server in New Zealand with static IP:
$ timedatectl
Local time: Wed 2023-11-01 16:01:30 UTC
Universal time: Wed 2023-11-01 16:01:30 UTC
RTC time: Wed 2023-11-01 16:01:30
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Why does it show wrong local time even though clock sync is on and NTP active?
And is there a way to correct this automatically and not by manually setting the time zone?
Thanks!
You don’t appear to have set your server’s timezone. It’s currently set to UTC ("Time zone: Etc/UTC (UTC, +0000)
"), but you’re in New Zealand so it should be showing 05:01:30 NZDT
.
NTP only ever synchronises with UTC, and based on when you posted your question I’d say that the UTC time looks about right.
Set your server’s timezone with this command (as root, or use sudo
):
timedatectl set-timezone NZ
If you want to leave the server running as UTC but change your account’s rendering of that time to local NZ time, leave timedatectl
alone but instead set the environment variable TZ
:
date # UTC => "Wed, 1 Nov 2023 16:35:15"
export TZ=NZ
date # NZ time (currently NZDT) => "Thu, 2 Nov 2023 05:35:15"