Friday, 17 January 2014

The Programmer's Guide to Application Programming in Florida (Eastern versus Central Standard Time)

This has been in .NET since version 3.5, and is an enhancement over the TimeZone class.

An interesting feature is that it contains cached data, such as data on the local time zone, and any other cached time zone, which can be cleared via ClearCachedData.

An example usage of the TimeZoneInfo class.

var cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");

(Side note: "Central Standard Time" precedes GMT by six hours. It is used in Northwestern Florida, Minnesota, Illinois and most of Kansas, though the Eastern part of Florida, Miami, Tampa, Orlando and the Florida Keys are all in the "Eastern" time zone, or "EST", or "Eastern Standard Time").

The time zone info object can be used to convert times in one time zone to another time zone, using the static method TimeZoneInfo.ConvertTime.