November 20, 2014

Set Local Date and Time on Linux

1. Switch to root user

sudo su

2. Open the clock file in the editor

nano /etc/sysconfig/clock

3. Make sure that the file contains the correct time zone, for example:

ZONE=”America/New_York

NOTE: if you want to check what zones are available, you can see all zones by typing this command: ls /usr/share/zoneinfo

4. Save the file and exit the editor

5. Create a symbolic link between /etc/localtime and your time zone file so that the instance finds the time zone file when it references local time information:

sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

6. Reboot the system to pick up new settings:

reboot

7. Test the result with this command:

 
date
8. Exit the root user
exit