Convert DateTime TimeZone from UTC

Posted on: Fri Jan 15 23:26:10 -0800 2010. Updated on: Fri Jan 15 23:26:50 -0800 2010.
Category: .NET C#

This is pretty easy once you know what you are doing:

DateTime newYorkTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindTimeZoneById("US Eastern Standard Time"));

BTW it is a good idea to keep times in the database in UTC that way it is easy to convert using above.

Comments:

Add a Comment:

simple_captcha.jpg
(human authentication)


Ads

Categories

About

Random foliage

This website is meant to be a reference for ASP Dot Net developers. The entries are a compilation of things I've figured out how to do and that I deem useful to keep of track for future reference. Assumptions: web development with: C Sharp (vb sucks), visual studio 05/08, .net 3.5, meant for programmers. Written by: James Reategui.