Groups | Blog | Home
all groups > dotnet faqs > december 2004 >

dotnet faqs : Time Zone Question


Oliver
12/30/2004 4:22:58 AM
Hello,

I am writing an application that will be used across multiple time zones
(Eastern to Pacific) and since much of the application revolves around time
stamps, I need a best practice for storing time information in a database
and displaying it correctly to the user (adjusted for his respective time
zone). I have been thinking about using UTC and adjusting everything when I
output it, but then the user cannot use the native data in the database
(e.g. for reporting services).

Is there any elegant way to do this (my dream would be a session-specific
time zone setting that will adjust all date to string and string to date
functions). Anybody had a similar problem?

I CANNOT SAY HOW MUCH YOUR HELP WILL BE APPRECIATED

Oliver

Dino Chiesa [Microsoft]
1/3/2005 3:51:17 PM
[quoted text, click to view]

Dealing with times across zones is tricky.

Using UTC and converting (late) seems to be a best practice.

The reporting issue - you should be able to solve that with some database
trickery, like UDFs for example. have the user pass his/her timezone into
the query, along with the time, and then within the UDF produce a UTC and
use that for the report.


see also
http://blogs.msdn.com/brada/archive/2004/04/13/112784.aspx
http://www.extremeexperts.com/sql/articles/UDFFunctions.aspx

-D


[quoted text, click to view]

AddThis Social Bookmark Button