Using timedatectl command to change time and date on RHEL7 Linux system

When not using NTP you may need to set your system time manually. You have two options to set time and date on your RHEL7 linux. First option is to use date 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 RTC times:

[root@rhel7 ~]# localectl
   System Locale: LANG=en_AU.iso88591
       VC Keymap: us
      X11 Layout: us
[root@rhel7 ~]# timedatectl
      Local time: Thu 2014-09-04 18:30:11 WST
  Universal time: Thu 2014-09-04 10:30:11 UTC
        RTC time: Thu 2014-09-04 10:30:10
        Timezone: Australia/Perth (WST, +0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

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 2015-06-02

[root@rhel7 ~]# timedatectl set-time '2015-06-02'
[root@rhel7 ~]# date
Tue Jun  2 00:00:02 WST 2015

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

[root@rhel7 ~]# timedatectl set-time '14:45:23'
[root@rhel7 ~]# date
Tue Jun  2 14:45:23 WST 2015

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@rhel7 ~]# timedatectl set-time '2016-12-13 13:45'
[root@rhel7 ~]# date
Tue Dec 13 13:45:01 WST 2016