Linux – Weird CentOS server behavior time zones

centos6linuxtimezone

I have purchased a CentOS 6.8 dedicated server to migrate from shared hosting, and I'm having trouble with the time zones not displaying properly.

I have changed the php.ini time zone to Europe/Dublin – it didn't work

I have changed the httpd.conf timezone to Europe/Dublin – it didn't work

And I am trying to change the actual CentOS timezone and this is where it gets weird. I changed time zone to Europe/Dublin from CST (which was the default), and it seems to think that Europe/Dublin is GMT+14.

Please see the image link below. The second date should have said Sat Jan 7 07:48:11 GMT 2017.

Weird server time zone situation

Best Answer

The CST time zone is GMT -6, so if CST time is 15:47 then GMT time is 21:47.

If you are saying that at the time you took the screenshot the time was supposed to be 07:48 in the morning, then your server time is not correct, and you need to synchronise it.

Run this command to synchronise the time to correct one:

ntpdate -s time.nist.gov

It is possible you don't have ntp installed at all on your server, in which case you need to install it with:

yum install ntp ntpdate ntp-doc

And start the NTP service to keep the time synchronised with:

/etc/init.d/ntpd start

Also make sure to set the NTP service to autostart on boot with:

chkconfig ntpd on