C# TimeZone IsDaylightSavingTime(DateTime)
Description
TimeZone IsDaylightSavingTime(DateTime)
returns
a value indicating whether the specified date and time is within a daylight
saving time period.
Syntax
TimeZone.IsDaylightSavingTime(DateTime)
has the following syntax.
public virtual bool IsDaylightSavingTime(
DateTime time
)
Parameters
TimeZone.IsDaylightSavingTime(DateTime)
has the following parameters.
time
- A date and time.
Returns
TimeZone.IsDaylightSavingTime(DateTime)
method returns true if time is in a daylight saving time period; otherwise, false.
Example
The following code shows how to use TimeZone.IsDaylightSavingTime()
.
//from w w w . ja va 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.