Inequality Operator

DateTime.Inequality Operator (DateTime, DateTime)


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 4.5
.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
© 2015 Microsoft