Time / Timezone in Linux

From vpsget wiki
Jump to: navigation, search

Before set timezone you should delete the current settings if they exists: Create backup

cp /etc/localtime /etc/localtime.bcp 

Delete current settings

rm /etc/localtime

Set new Timzone, for example:

ln -s /usr/share/zoneinfo/CET  /etc/localtime

Check Date/Time:

date

If you see that date/time is incorrect you should sync it using ntpd service. Sure you can set it manually. If ntpd service not installed install it using yum or apt-get. NOTE that you can't use ntpd from ovz container.In general you can only change timzone from ovz container

Start ntdp:

service ntpd start

force sync:

ntpdate pool.ntp.org

Also you can configure ntpd servers in /etc/ntp.conf. for example add next line to conf:

server pool.ntp.org

Here is examples how to set time/date manually:

date --set="23 Nov 2013 11:00:00"
date --set="11:00:00"