💾 Archived View for darknesscode.xyz › notes › datetimectl.gmi captured on 2024-07-09 at 00:26:31. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-05)
-=-=-=-=-=-=-
About systemd based Linux system, with systemd based system you need to use the timedatectl command to set or view the current date and time.
timedatectl
The output will be something like
Local time: Sun 2021-01-17 21:21:21 PST Universal time: Mon 2021-01-18 05:21:21 UTC RTC time: Mon 2021-01-18 05:21:27 Time zone: America/Los_Angeles (PST, -0800) System clock synchronized: no NTP service: inactive RTC in local TZ: no
To change both the date and time, use the following syntax:
timedatectl set-time YYYY-MM-DD HH:MM:SS
Where
HH : An hour. MM : A minute. SS : A second, all typed in two-digit form. YYYY: A four-digit year. MM : A two-digit month. DD: A two-digit day of the month.
Example
timedatectl set-time '2021-01-16 11:04:20'
The syntax for time
timedatectl set-time HH:MM:SS
The syntax for date
timedatectl set-time YYYY-MM-DD
timedatectl set-timezone 'Asia/Kolkata'
Simply type the following command:
timedatectl set-ntp yes
----------
----------
© DarknessCode