Re: [PHP] Holding "datetimes" in a DB.

[email protected] (Lester Caine)
Newsgroups php.general
Message-ID <[email protected]>
Richard Quadling wrote:
> My heads trying to remember something I may or may not have known to start with.
>
> If I hold datetimes in a DB in UTC and can represent a date to a user
> based upon a user preference Timezone (not an offset, but a real
> timezone : Europe/Berlin, etc.) am I missing anything?

The simple answer is ... No

Slightly more complex ...
If you are displaying timed events in the future and need to support multiple 
time zones, then using the browser TZ setting is useless, you need to work with 
a daylight saving setting instead. The site 'default' can either be UTC or it 
can be a particular timezone, but what will not work reliably is to offset from 
the browser information.

If all of your users are in the same timezone, then UTC without setting a 
timezone makes perfect sense and you even ignore even the daylight saving 
changes. Where the fun comes is where you are displaying times which straddle 
the daylight saving switches such as a train movement where the time you need to 
display jumps. In this case you have to use UTC for the movement, and display 
with the correct daylight saving offest.


-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.