track ip addresses, phone numbers, etc

Change the server date and time in CentOS

Published on 25 July 2016

This is a short tutorial on changing the server time in CentOS. At work, I use CentOS servers with versions 6.4, 6.5 and 7.0. To change the server date and time to July 25, 2016, the syntax is

date MMDDhhmmYYYY

Run this command:

date 072522172010

Verify that the date has changed.

$ date
Wed Jul 25 22:10:49 EDT 2016

The date has been changed. However, it will revert after a reboot. To make the datetime change permanent, follow these steps.

First, login as root.

sudo su -

Next, run these steps.

rm /etc/localtime
ln -s /usr/share/zoneinfo/GMT /etc/localtime
date 072522172010
hwclock --systohc

After a reboot, you will notice that the date and time have been permanently updated.

Created on 25 July 2016

Affiliate Disclosure: Some of the links to products on this blog are affiliate links. It simply means, at no additional cost to you, we’ll earn a commission if you click through and buy any product.