Come trovare la data di cambio dell'ora solare / legale con ASP.Net C#

Posted by: ollie10 9/7/2009 4:46 PM

In questo esempio vediamo come con c# ed una funzione della classe TimeZone, tale funzione riceve l'anno come parametro e restituirà la data e ora del cambio

TimeZone tz = TimeZone.CurrentTimeZone;
System.Globalization.DaylightTime dc = tz.GetDaylightChanges(2009);
Console.WriteLine(dc.Start);
Console.WriteLine(dc.End);
Console.WriteLine(dc.Delta);

Questo sarà il risultato che otterremo

29/03/2009 2.00.00
25/10/2009 3.00.00
01:00:00
Tags: , , ,
Categories: Asp.NET - C# | BlogEngine.NET
Permalink | Comments (0)
RSS comment feed

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading