using System;
using System.Collections.ObjectModel;
public class MainClass
{
public static void Main()
{
DateTime thisDate = new DateTime(2010, 3, 10, 0, 0, 0);
DateTime dstDate = new DateTime(2010, 6, 10, 0, 0, 0);
DateTimeOffset thisTime = new DateTimeOffset(dstDate, new TimeSpan(-7, 0, 0));
ShowPossibleTimeZones(thisTime);
}
private static void ShowPossibleTimeZones(DateTimeOffset offsetTime)
{
TimeSpan offset = offsetTime.Offset;
Console.WriteLine("{0} could belong to the following time zones:", offsetTime.ToString());
ReadOnlyCollection timeZones = TimeZoneInfo.GetSystemTimeZones();
foreach (TimeZoneInfo timeZone in timeZones)
{
if (timeZone.GetUtcOffset(offsetTime.DateTime).Equals(offset)){
Console.WriteLine(" {0}", timeZone.DisplayName);
}
}
}
}