DateTime::Equals Method (DateTime, DateTime)
.NET Framework (current version)
Returns a value indicating whether two DateTime instances have the same date and time value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- t1
-
Type:
System::DateTime
The first object to compare.
- t2
-
Type:
System::DateTime
The second object to compare.
The following example demonstrates the Equals method.
System::DateTime today1 = System::DateTime( System::DateTime::Today.Ticks ); System::DateTime today2 = System::DateTime( System::DateTime::Today.Ticks ); System::DateTime tomorrow = System::DateTime( System::DateTime::Today.AddDays( 1 ).Ticks ); // todayEqualsToday gets true. bool todayEqualsToday = System::DateTime::Equals( today1, today2 ); // todayEqualsTomorrow gets false. bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow );
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
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
Available since 8
.NET Framework
Available since 1.1
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
Show: