How to convert Timezones

Here is a code sample (in C#) that I found for converting datetime between time zones.  This only works in the 3.5 framework (via System.TimeZoneInfo).

DateTime oldTime = new DateTime(2007, 6, 23, 10, 0, 0);
TimeZoneInfo timeZone1 = TimeZoneInfo.FindSystemTimeZoneById(“Central Standard Time”);
TimeZoneInfo timeZone2 = TimeZoneInfo.FindSystemTimeZoneById(“Eastern Standard Time”);
DateTime newTime = TimeZoneInfo.ConvertTime(oldTime, timeZone1, timeZone2);

 

Here is the url where I found this info.
http://pietschsoft.com/post/2007/06/23/NET-35-How-to-Convert-from-one-TimeZone-to-another.aspx

Advertisements

Got something to add?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s