Microsoft Most Valuable Professional

Chris Pietschmann

An MVP From Wisconsin



.NET 3.5: How to Convert from one TimeZone to another

The ability to convert directly from one timezone to another is coming (finally!) in .NET 3.5 via the addition of the System.TimeZoneInfo object.

Example C# Code:
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);

Currently rated 5.0 by 4 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: General
Posted by crpietschmann on Saturday, June 23, 2007 11:46 AM
Permalink | Comments (2) | Post RSSRSS comment feed

Related posts

Comments

Sanjivani

Thursday, December 06, 2007 4:30 PM

Sanjivani

I want TimeZone conversion from UTC to Indian time not based on Local time.

N M Reddy

Sunday, December 16, 2007 3:26 PM

N M Reddy

Hi,
First convert Local Time or required Time to UTC using DateTime.Now.ToUniversalTime(), from there easily you can convert to IST or some other required format.

Comments are closed

About the author

I'm Chris Pietschmann, go to the About Me page to learn more about me.

Search

Sponsors

Web.Maps.VE - ASP.NET AJAX Virtual Earth Mapping Server Control

Recent comments

Disclaimer


This work is licensed under a Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the posted content.
© Copyright 2004 - 2008 Chris Pietschmann