TimeZone.IsDaylightSavingTime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a value indicating whether a specified date and time is within a daylight saving time period.
Overloads
IsDaylightSavingTime(DateTime) |
Returns a value indicating whether the specified date and time is within a daylight saving time period. |
IsDaylightSavingTime(DateTime, DaylightTime) |
Returns a value indicating whether the specified date and time is within the specified daylight saving time period. |
IsDaylightSavingTime(DateTime)
- Source:
- TimeZone.cs
- Source:
- TimeZone.cs
- Source:
- TimeZone.cs
Returns a value indicating whether the specified date and time is within a daylight saving time period.
public:
virtual bool IsDaylightSavingTime(DateTime time);
public virtual bool IsDaylightSavingTime (DateTime time);
abstract member IsDaylightSavingTime : DateTime -> bool
override this.IsDaylightSavingTime : DateTime -> bool
Public Overridable Function IsDaylightSavingTime (time As DateTime) As Boolean
Parameters
- time
- DateTime
A date and time.
Returns
true
if time
is in a daylight saving time period; otherwise, false
.
Remarks
The year to which the daylight saving time period applies is derived from the time
parameter.
Because the TimeZone class supports a single daylight saving time adjustment rule, the IsDaylightSavingTime(DateTime) method applies the current adjustment rule to any date, regardless of whether the adjustment rule was in effect on that date. Assuming that the operating system itself has accurate historic daylight saving time data, a more accurate result is available by using the TimeZoneInfo.IsDaylightSavingTime method. Whenever possible, use the TimeZoneInfo.IsDaylightSavingTime method.
See also
Applies to
IsDaylightSavingTime(DateTime, DaylightTime)
- Source:
- TimeZone.cs
- Source:
- TimeZone.cs
- Source:
- TimeZone.cs
Returns a value indicating whether the specified date and time is within the specified daylight saving time period.
public:
static bool IsDaylightSavingTime(DateTime time, System::Globalization::DaylightTime ^ daylightTimes);
public static bool IsDaylightSavingTime (DateTime time, System.Globalization.DaylightTime daylightTimes);
static member IsDaylightSavingTime : DateTime * System.Globalization.DaylightTime -> bool
Public Shared Function IsDaylightSavingTime (time As DateTime, daylightTimes As DaylightTime) As Boolean
Parameters
- time
- DateTime
A date and time.
- daylightTimes
- DaylightTime
A daylight saving time period.
Returns
true
if time
is in daylightTimes
; otherwise, false
.
Exceptions
daylightTimes
is null
.
Remarks
The TimeZoneInfo.IsDaylightSavingTime method provides the same functionality as this overload of the IsDaylightSavingTime method. Whenever possible, use the TimeZoneInfo.IsDaylightSavingTime method.