LinuxChanging date and timezone in Linux

Changing date and timezone in Linux

I am on CentOS 6.5

You can use the date command to see the current time and timezone

[naveen@localhost ~]$ date
Thu Sep 18 13:54:34 MDT 2014

To see the hardware clock

Thu 18 Sep 2014 01:55:42 PM MDT -0.114261 seconds

To change the date

sudo date --set="Sep 18 2014 13:55:00"

To change your timezone, we need to replace the file /etc/localtime

The available timezones are located in /usr/share/zoneinfo/

All you have to do is copy the required file from there to /etc/localtime to change your timezone

First make a backup of your existing /etc/localtime file

sudo mv /etc/localtime /etc/localtime.bkp
sudo cp /usr/share/zoneinfo/UTC /etc/localtime

Now when i execute the command i get the new date in UTC

[naveen@localhost ~]$ date
Thu Sep 18 19:57:29 UTC 2014


Categories: Linux Tags: ,


No Comments Yet. Be the first?

Post a comment

Your email address will not be published. Required fields are marked *