Change Time and Date on RHEL/CentOS and Fedora
This post shows how to set the time and date in the command line on RHEL/CentOS 8 and Fedora 30. The correct system time is essential for systems and creates the prerequisite for the proper functioning of many service. The command line tool
timedatectl use to check and modify time setting.
Run the query using
timedatectl without additional arguments:
$ timedatectl Local time: Wed 2021-02-17 17:04:29 GMT Universal time: Wed 2021-02-17 17:04:29 UTC RTC time: Wed 2021-02-17 16:57:58 Time zone: Europe/London (GMT, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: n
To set-time switch along with the format of time in HH:MM:SS (Hour, Minute, and Seconds):
$ timedatectl set-time 14:09:0
To set-time switch along with the format of date in YY:MM:DD (Year, Month, Day):
$ timedatectl set-time 2021-02-1
To set both date and time:
$ timedatectl "2021-02-18 14:09:05"
Find out if your hardware clock is set to local timezone:
$ timedatectl | grep loca
Set your hardware clock to local timezone:
$ timedatectl set-local-rtc
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?