How to store and compare time-zone sensitive times

Posted by Chad Moran on Stack Overflow See other posts from Stack Overflow or by Chad Moran
Published on 2010-04-01T13:49:07Z Indexed on 2010/04/01 13:53 UTC
Read the original article Hit count: 231

I have a data structure where an entity has times stored as an int (minutes into the day) for fast comparison. The entity also has a Foreign Key reference back to a TimeZone table which contains the .NET CLR ID Name and it's Standard Time/Daylight Time acronyms.

Since this information is stored as time-zone insensitive - I was wondering how in LINQ to SQL I could convert this into a UTC DateTime for comparison against other times that will be in UTC.

Just to be clear this conversion has to be done server-side so that I can execute filtering on the SQL Server and not the client.

I am using .NET 3.5 SP1 and SQL Server 2008.

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about sql-server-2008