Convert UTC DateTime to Local Time (Not My Local Time)

Convert UTC DateTime to Local Time (Not My Local Time)

Post by Jonathan W » Mon, 02 Nov 2009 07:38:11


I have a DateTime value that represents a UTC time (DateTime). I also have a
UTC offset value (double) and a Daylight Savings Time value (bool) for a
local time. How best to calculate the local time from this data?

I've been searching the web for a while now. I've found a lot of interesting
new classes and various ways to approach this. But not one is dealing with
data in the form described above.

More Info:

I'm building a website where people can post comments. The date of each
comment is stored in the database as UTC time. My site also needs to track
which region each user is from. So my region table contains time zone
information which I need to apply to the UTC time. I'm opening to storing
different data types, etc. But I don't want to make this much more
complicated.

Thanks.

Jonathan
 
 
 

Convert UTC DateTime to Local Time (Not My Local Time)

Post by Mark Rae [ » Mon, 02 Nov 2009 07:59:24


<snip>

This question is already being discussed in the C# newsgroup...


--
Mark Rae
ASP.NET MVP
http://www.yqcomputer.com/

 
 
 

Convert UTC DateTime to Local Time (Not My Local Time)

Post by Jonathan W » Mon, 02 Nov 2009 09:08:00

I'm aware of that--I'm involved in that discussion. But it is not being
productive. So, if someone wants to weigh in here, why not let them?


Jonathan