Windows apps
Collapse the table of content
Expand the table of content
Information
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.

DateTimeOffset::Equality Operator (DateTimeOffset, DateTimeOffset)

 
equivalentCodeEntityM:System.DateTimeOffset.Equals(System.DateTimeOffset,System.DateTimeOffset)

Determines whether two specified DateTimeOffset objects represent the same point in time.

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

public:
static bool operator ==(
	DateTimeOffset left,
	DateTimeOffset right
)

Parameters

left
Type: System::DateTimeOffset

The first object to compare.

right
Type: System::DateTimeOffset

The second object to compare.

Return Value

Type: System::Boolean

true if both DateTimeOffset objects have the same UtcDateTime value; otherwise, false.

The Equality method defines the operation of the equality operator for DateTimeOffset objects. It enables code such as the following:

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

Before evaluating the left and right operands for equality, the operator converts both values to Coordinated Universal Time (UTC). The operation is equivalent to the following:

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

In other words, the Equality method determines whether the two DateTimeOffset objects represent a single point in time. It directly compares neither dates and times nor offsets. To determine whether two DateTimeOffset objects represent the same time and have the same offset value, use the EqualsExact method.

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