Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DateTime.Inequality Operator (DateTime, DateTime)


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


Determines whether two specified instances of DateTime are not equal.

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

public static bool operator !=(
	DateTime d1,
	DateTime d2


Type: System.DateTime

The first object to compare.

Type: System.DateTime

The second object to compare.

Return Value

Type: System.Boolean

true if d1 and d2 do not represent the same date and time; otherwise, false.

The Inequality operator determines whether two DateTime values are not equal by comparing their number of ticks. Before comparing DateTime objects, make sure that the objects represent times in the same time zone. You can do this by comparing the values of their Kind property.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
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
© 2018 Microsoft