C#

.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);
Chris Pietschmann
Chris Pietschmann
Microsoft MVP | App Innovation Leader | Azure, AI & DevOps Architect | HashiCorp Ambassador | Author
I'm a Practice Leader, App Innovation specialist, solution architect, developer, SRE, trainer, and author with 25+ years of experience helping enterprises turn AI, app modernization, cloud architecture, and DevOps into real business outcomes.