TimeZoneInfo::IsInvalidTime Method (DateTime)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Indicates whether a particular date and time is invalid.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

bool IsInvalidTime(
	DateTime dateTime


Type: System::DateTime

A date and time value.

Return Value

Type: System::Boolean

true if dateTime is invalid; otherwise, false.

An invalid time falls within a range of times for the current time zone that cannot be mapped to Coordinated Universal Time (UTC) due to the application of an adjustment rule. Typically, invalid times occur when the time moves ahead for daylight saving time. See the Example section for an illustration.

The value of the Kind property of the dateTime parameter affects whether dateTime represents an invalid time, as the following table shows.

DateTime.Kind property

TimeZoneInfo object (if applicable)




Determines whether the time is invalid.


TimeZoneInfo::Utc or a non-local time zone.

Converts dateTime to the time of the TimeZoneInfo object and returns false.


Not applicable.

Assumes dateTime is the time of the TimeZoneInfo object and determines whether it is invalid.


Not applicable.

Returns false.

Notes to Callers:

On Windows XP systems, this method applies only the adjustment rule if the current instance is TimeZoneInfo::Local. As a result, the method may not accurately report whether dateTime is an invalid time for periods before the current adjustment rule came into effect. For more information, see the Notes for Callers section in the Local property.

In the Pacific Time zone, daylight saving time begins at 2:00 A.M. on April 2, 2006. The following code passes the time at one-minute intervals from 1:59 A.M. on April 2, 2006, to 3:01 A.M. on April 2, 2006, to the IsInvalidTime method of a TimeZoneInfo object that represents the Pacific Time zone. The console output indicates that all times from 2:00 A.M. on April 2, 2006, to 2:59 A.M. on April 2, 2006, are invalid.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top