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

[email protected] (Simon Schick)
Newsgroups php.general
Message-ID <CAJWj5+G56p9sFCKf=QNvAQ=z2cmGtD9i3r8TfLTgTAfBmTbNJw@mail.gmail.com>
Hi, Richard

I, too, tought about switching to UTC times in my database. The only reason
for me was to get prepared for globalisation.

A good article about this consideration is written at PHP Gangsta (sorry,
German only):
http://www.phpgangsta.de/die-lieben-zeitzonen

The reason, why I did not switch to UTC, was the reason, that most of the
pages I host have visitors mostly from Germany.

If you have visitors from different countries, you first have to find out
which time-zone they're in, which can be quite messy. Just watch this video
about timezones (I added a jump-node that get's you directly to the
interesting stuff):
http://www.youtube.com/watch?feature=player_detailpage&v=84aWtseb2-4#t=230s

But basically that doesn't matter that much, since you - anyways - don't
get a time from the client, so you're stuck in this problem either way ...

Each example, I can come up with, does apply to UTC saved timestamps as
well as to non-UTC based timestamps.

One consideration, if you only have to operate in one timezone, like I do,
is stuff like cron-jobs.
Since I only have Germany as main-visitor-source, I can safely configure
the server to Europe/Berlin and pull out stuff like birthday-information at
midnight.

Please do also keep in mind here, that there are not only
full-hour-timezones :)
http://en.wikipedia.org/wiki/List_of_UTC_time_offsets

But .... I can't come up with a problem that you wouldn't have with a local
timezone instead of UTC ...

Bye
Simon

On Fri, Mar 1, 2013 at 11:49 AM, Richard Quadling <[email protected]>wrote:

> Hi.
>
> 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?
>
> Richard.
> --
> Richard Quadling
> Twitter : @RQuadling
> EE : http://e-e.com/M_248814.html
> Zend : http://bit.ly/9O8vFY
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
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.