Re: Holding "datetimes" in a DB.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 1, 2013 at 7:04 PM, Sebastian Krebs <krebs.seb@xxxxxxxxx> wrote:

> 2013/3/2 tamouse mailing lists <tamouse.lists@xxxxxxxxx>
>
> > On Fri, Mar 1, 2013 at 11:53 AM, Matijn Woudt <tijnema@xxxxxxxxx> wrote:
> > > On Fri, Mar 1, 2013 at 11:49 AM, Richard Quadling <rquadling@xxxxxxxxx
> > >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.
> > >>
> > >
> > > I would only use this if you're planning to have servers all around the
> > > world in different timezones, then it would be easier to interchange
> > data.
> > > Otherwise, stick with ur local timezone and it will save you a lot of
> > > unneeded timezone conversions probably.
> > >
> > > - Matijn
> >
> > This may be just me, but I've always preferred my servers, database,
> > and such to run UTC, and let users select their own time zone they'd
> > like to see.
> >
>
> Well, imo it depends ;) There are cases, where it is interesting to know,
> when from the users point of view they have created the entity (like a blog
> post, a comment, or something like that). The TZ is part of the data and
> converting it silently to UTC is always data-loss. So in most cases it is
> OK, but not in every :) You can still convert from entity-TZ to UTC to
> user-TZ later. Its just one additional step.
>
> Regards,
> Sebastian
>
>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> github.com/KingCrunch
>

I have found that it's always best to stick to UTC ... regardless of
anything else ... since saving the users local and going to and from can
easily be wrapped into a single entry/exit function and I've had to many
instances where it was saved as local and it came back to bite simply to
save a few minutes.

That said this is something I feel should be documented since for many
newcomers they usually don't think about timezones until it becomes a
problem ...

Cheers!
-- 
Nickolas Whiting - prggmr.org
 - Remember to write less code that does more faster -

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux