Change time and date on RHEL7 RHEL8 Linux system by using timedatectl command

You have below option to set time and date on your RHEL7 RHEL8 linux.

First execute date or timedatectl command to do this job or engage dedicated systemd timedatectl command. By default and without any arguments timedatectl will display a current time, local, universal and UTC times:

[root@amitmaheshwari.in]# date
Tue Aug  6 13:27:12 IST 2019
[root@veritas1 rhel7_x86_64]#


[root@amitmaheshwari.in]# timedatectl
      Local time: Tue 2019-08-06 14:28:25 IST
  Universal time: Tue 2019-08-06 08:58:25 UTC
        RTC time: Tue 2019-08-06 08:58:26
       Time zone: Asia/Kolkata (IST, +0530)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@amitmaheshwari.in]#


As already mentioned above timedatectl command can be used on Redhat 7 to set a date and time. The following linux command will change a date to 2019-08-06

[root@amitmaheshwari.in ~]# timedatectl set-time '2019-08-06'
[root@amitmaheshwari.in ~]# date
Tue Aug  6 13:27:12 IST 2019

To set a new time to 14:27:23 supply a new time as an argument:

[root@amitmaheshwari.in ~]# timedatectl set-time '14:27:23'
[root@amitmaheshwari.in ~]# date
Tue Aug  6 14:27:12 IST 2019


The timedatectl command also allows to change time and date at the same time. For example to set date to 13th Dec 2016 and time 13:45 we combine both values and supply them as an argument:

[root@amitmaheshwari.in ~]# timedatectl set-time '2019-08-06 14:27'
[root@amitmaheshwari.in ~]# date
Tue Aug  6 14:27:12 IST 2019