Tuesday, April 15, 2008

Change the Date and Timezone in Centos

Log into your server then retrieve the current date and timezone by typing in

date


all timezone information is stored at /usr/share/zoneinfo you can browse to this by typing

cd /usr/share/zoneinfo


you should see a list of all the available timezones including folders for countries which have multiple time zones eg. America

so to change the time zone just enter the following

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime


If you then want to manually set the time to 30/03/2008 09:57, the format to enter the date is 'mmddhhmmyyyy'
033009572008


The following command will update your hardware clock
hwclock --systohc


And now when you type in 'date' you should see an up to date clock

No comments: