Reply to Re: Running an intranet PHP server... handling time in scripts

Your name:

Reply:


Posted by C. on 10/10/07 11:57

On 10 Oct, 12:03, Ben Bradley <no...@nowhere.net> wrote:
>
> 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.
>

Not the way I'd do it - Unix timestamps only operate for a realtively
narrow timeband. I'd strongly recommend you use MySQL DATETIME fields
and format them from Zulu/UTC/GMT (your truly predates the Unix
epoch).

Last time I looked, MySQL handling of timezones was a bit ropey (but
the format allows for dates from year 0000 to year 9999) so you might
want to go via Unix timestamp to get back to a local time using
set_locale() and date().

> 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?
>

It does on Unix/Linux if the Locale is set correctly and the TZ files
are installed.

> 2) The Default timezone setting in our php.ini file (as discovered from
> phpinfo) is currently Europe/London
> Do I need to change any 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?
>

Certainly for Apache on *nix, it logs in GMT by default.

HTH

C.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация