I do just about what you do

1. set a _javascript_ cookie with persons time zone
2. read that time zone with cookie. cf variable
3. compare with server time zone.  

if server time zone is -4 I know we are in dst, if server time zone
is -5 I know we are in est.
4. if server time zone is 4. I add an hour, if its -5 I leave it alone.
5. it's a bit screwy, but it works.

...tony

tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337

-----Original Message-----
From: cf-talk [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 1:53 PM
To: CF-Talk
Subject: UTC and daylight savings time...

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