first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

C# Code: Converting GMT (Greenwich Mean Time) to Local Time; System.TimeZone.CurrentTimeZone; DateTime.ToLocalTime()

Converting GMT (Greenwich Mean Time) to local time is useful for reading the publication dates in an RSS feed. When you are unconcerned about the time zone adjustment rules in effect for the current date/time, then use the DateTime.ToLocalTime() method:

DateTime d = DateTime.Parse(gmtString);
DateTime dLocal = d.ToLocalTime();

When time zone adjustment rules are an issue then use the TimeZone.ToLocalTime() method:

DateTime d = DateTime.Parse(gmtString);
DateTime dLocal = TimeZone.CurrentTimeZone.ToLocalTime(d);

The TimeZone.GetDaylightChanges() and the TimeZone.GetUtcOffset() methods can be used to determine a numeric value for time zone adjustment rules.

mod date: 2008-10-17T07:35:06.000Z