C# DateTime IsDaylightSavingTime

Description

DateTime IsDaylightSavingTime indicates whether this instance of DateTime is within the daylight saving time range for the current time zone.

Syntax

DateTime.IsDaylightSavingTime has the following syntax.


public bool IsDaylightSavingTime()

Returns

DateTime.IsDaylightSavingTime method returns true if the value of the Kind property is Local or Unspecified and the value of this instance of DateTime is within the daylight saving time range for the local time zone; false if Kind is Utc.

Example

The following code shows how to use DateTime.IsDaylightSavingTime method.


using System;//  w ww  .j  av  a 2 s.c  o  m
public class MainClass{
  public static void Main(String[] argv){  
    DateTime date1 = new DateTime(2008, 6, 1, 7, 47, 0);
    Console.WriteLine(date1.IsDaylightSavingTime());
   
  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version