Check if the date and time is within a daylight saving time period in CSharp
Description
The following code shows how to check if the date and time is within a daylight saving time period.
Example
//from w ww. ja v a 2 s . c om
using System;
using System.Globalization;
class TimeZoneDemo
{
static void Main( )
{
TimeZone localZone = TimeZone.CurrentTimeZone;
Console.WriteLine(localZone.IsDaylightSavingTime(DateTime.Now) );
}
}
The code above generates the following result.