How to Change Date and Time Linux on RHEL 6/7 and CentOS 6/7

Share this Article :

Change Date and Time

This post assumed that your Red Hat Enterprise Linux 6 (RHEL 6) does not have Date/Time Properties installed. In order to change the date and

In order to change date and time you will have to perform the changes from the command line. Note that in order to perform actions described in this post, you have to be logged in as a root:

1. Change the current date with the following form :

# date +%D -s YYYY-MM-DD

Linux Date Format : YYYY with a four-digit year, MM with a two-digit month, and DD with a two-digit day of the month.
Example :

# date +%D -s 2012-05-30
05/30/12

2. Change the current time with the following form :

# date +%T -s HH:MM:SS

If your system clock is set to use UTC (Coordinated Universal Time), add the following option :

# date +%T -s HH:MM:SS -u

Note : HH stands for an hour, MM is a minute, and SS is a second

Also Read :   How to Modify Date and Timestamps Using touch on CentOS

Example :

# date +%T -s 22:30:00
22:30:00

or

[[email protected] ~]# date +%T -s 22:30:00 -u
22:30:00

3. How to Display current date and time :

[[email protected] ~]# date
Wed May 30 22:30:04 MYT 2012

Reference


Leave a Reply