While we're discussing best practices today I have a quick question
regarding time zones, UTC, etc, etc.

I believe that the preferred method of storing dates and times in your
database is in UTC.  I have no problem running all of the servers in the
UTC time zone even.

>From there it's a question of what's the best way to convert the UTC
back to the user's local time zone.

My practice has always been to use _javascript_ to determine the user's
time zone offset and use that to calculate their local time from the
UTC.

But one problem I foresee is after a time change (spring forward, fall
back).

Pretend for a moment that a transaction occurs on February 22nd, 2004 at
12:00pm

If I look up that transaction on February 25th the time will still show
12:00pm.

But what happens when I look up that transaction on May 1st, 2004?  My
time zone offset is now different by an hour.  So, theoretically, the
transaction from Feb 22nd will no longer return 12:00pm... It will be
incorrect by one hour.

Does the built in ColdFusion function(s) account for this?  Or would one
have to use some other method to ensure accuracy?

We already know DateDiff does some quirky stuff... So that's what got me
thinking about this scenario...

On a different note... A completely different solution might be to
calculate the user's local time on the fly and store it in the database
record at that specific moment in time.  Of course this has it's own set
of issues too...

-Novak
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to