Set Date and Time

Set Date and Time in CentOS

The date command is used to set the date and time on a CentOS server. The format used is: MMDDhhmmYYYY

MM Month of year 01-12
DD Day of month 01-31
hh Hour of day (24 hour clock) 00-23
mm Minute of the hour 00-59
YYYY Year 2014 (for example)

So, to set November 25th, 2014 (11/25/2014) at 8:00AM, the command would be:

date 112508002014

Information on setting the timezone.

Sync System Clock to Hardware Clock

To sync the system time we just set to the hardware clock, use the following command.

hwclock --systohc