iLaYa  ツ
iLaYa ツ

Reputation: 4017

How to resolve the time difference b/w local server time and GMT time?

date_default_timezone_set('Asia/Calcutta');
echo date('d-m-y  h:i:s',time());
-------------------------------------------
26-12-2012 03:07:48

At the same time GMT +05:30 from here

26-12-2012 03:12:25

It's giving some time difference in minutes, now i want to work with time ago function with local server time but local server is giving about -4 minutes from the GMT+05:30. How to resolve this issue?

Few days back i changed the server time as GMT+05:30 with the help of Admin, now again its giving the difference.

Upvotes: 0

Views: 334

Answers (1)

Steven De Groote
Steven De Groote

Reputation: 2233

The best thing to do here is run a cronjob every day/week which synchronizes the time of your server to a timeserver. You can easily do this with ntpdate command

http://www.bytechemist.com/2009/06/25/use-cron-and-ntpdate-to-keep-your-linux-servers-time-updated/

Upvotes: 1

Related Questions