Page 1 of 1

Running an intranet server... handling date/time and timezon

Posted: Tue Oct 09, 2007 7:31 am
by batfastad
Hi everyone

We're in the process of setting up an intranet solution using Apache, PHP and MySQL.
Currently it's all running on windows server 2000 but once we're closer to completion we will move all this over to Linux.

My question relates to what the best way is to handle dates/times with regards to daylight savings time.
And we've managed to get ourselves confused over it all in the process.

At the moment we've been storing all dates/times as Unix timestamps in our MySQL database, as a standard integer field. Which we noticed was the same way phpBB does it, so it can't be a bad idea.

At the moment all our users are in our UK office

But when we convert those values to readable dates, we usually use the PHP date command:

Code: Select all

date('j M y H:i', $timestamp);
At the moment running that using the current time does return the correct

Here's my questions:
1) When we're in BST (British Summer Time) which is 1hr ahead of GMT, does that function provide an automatic correction?

2) The Default timezone setting in our php.ini file (as discovered from phpinfo) is currently Europe/London
Do I need to change the timezone of Apache or MySQL on our server from BST to GMT when the clocks change, in order to make sure we're storing accurate timestamps with our data?

3) Our Windows 2000 Server is set to GMT timezone, and the box is checked for Automatically adjust clock for daylight saving changes
Also we have it synchronising time using NTP with our local IPCop firewall box, which itself syncs from 0.uk.pool.ntp.org and uk.pool.ntp.org
Is there anything we need to be doing on the server when the clocks change, to ensure we're getting correct values?


We were trying to think through all this earlier today, and just got ourselves totally confused in the end.
So I'd appreciate it if someone can give us some advice and help us work through our confusion


Thanks
Ben

Re: Running an intranet server... handling date/time and tim

Posted: Tue Oct 09, 2007 9:36 am
by feyd
batfastad wrote:1) When we're in BST (British Summer Time) which is 1hr ahead of GMT, does that function provide an automatic correction?
Test it.
batfastad wrote:2) The Default timezone setting in our php.ini file (as discovered from phpinfo) is currently Europe/London
Do I need to change the timezone of Apache or MySQL on our server from BST to GMT when the clocks change, in order to make sure we're storing accurate timestamps with our data?
Test it.
batfastad wrote:3) Our Windows 2000 Server is set to GMT timezone, and the box is checked for Automatically adjust clock for daylight saving changes
Also we have it synchronising time using NTP with our local IPCop firewall box, which itself syncs from 0.uk.pool.ntp.org and uk.pool.ntp.org
Is there anything we need to be doing on the server when the clocks change, to ensure we're getting correct values?
Probably turn off automatic adjustment or switch to UTC, which doesn't observe daylight time, if memory serves.