Example #1
0
 public static void Main()
 {
     // Retrieve Eastern Standard Time zone from registry
     try
     {
         TimeZoneSerialization tzs = new TimeZoneSerialization();
         TimeZoneInfo          est = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
         // Create custom Eastern Time Zone for historical (pre-1918) conversions
         CreateTimeZone();
         // Call conversion function with one current and one pre-1918 date and time
         Console.WriteLine(ConvertUtcTime(DateTime.UtcNow, est));
         Console.WriteLine(ConvertUtcTime(new DateTime(1900, 11, 15, 9, 32, 00, DateTimeKind.Utc), est));
     }
     catch (TimeZoneNotFoundException)
     {
         Console.WriteLine("The Eastern Standard Time zone is not in the registry.");
     }
     catch (InvalidTimeZoneException)
     {
         Console.WriteLine("Data on the Eastern Standard Time Zone in the registry is corrupted.");
     }
 }
Example #2
0
    static void Main()
    {
        TimeZoneSerialization tzSerialization = new TimeZoneSerialization();

        tzSerialization.DeserializeTimeZones();
    }