Not logged in - Login

Convert from UTC time to other time zone

This sample demonstrates how to convert from UTC time to another time zone.

// get the current UTC time.
DateTime dtUniversalTime = DateTime.Now.ToUniversalTime();

// get the time zone info for the time zone we're interested in.
TimeZoneInfo zone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
// note: use the TimeZoneInfo.GetSystemTimeZones() function to get the list of available time zones.

// do the conversion
dtTemp = TimeZoneInfo.ConvertTimeFromUtc(dtUniversalTime, zone);

See this post for a list of valid Time Zone ID values.