System Namespace DateTime Structure
Returns a value indicating whether this instance is equal to a specified object.
[ VB ]
<Serializable>
Overrides Overloads Public Function Equals ( _
ByVal value As Object _
} As Boolean
[ C# ]
[ Serializable ]
public override bool Equals (
object value
};
[ C++ ]
[ Serializable ]
public: bool Equals (
Object* value
};
[ JScript ]
public Serializable
override function Equals (
value : Object
} : Boolean;
- value
- An object to compare with this instance.
true if value is an instance of DateTime and equals the value of this instance; otherwise, false.
The below code snippet demonstrates using the Equals method.
System.DateTime today1 =
new System.DateTime ( System.DateTime.Today.Ticks );
System.DateTime today2 =
new System.DateTime ( System.DateTime.Today.Ticks );
System.DateTime tomorrow =
new 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 );
Dim today1 As New System.DateTime ( System.DateTime.Today.Ticks )
Dim today2 As New System.DateTime ( System.DateTime.Today.Ticks )
Dim tomorrow As New System.DateTime ( _
System.DateTime.Today.AddDays ( 1 ).Ticks )
' todayEqualsToday gets true.
Dim todayEqualsToday As Boolean = System.DateTime.Equals ( today1, today2 )
' todayEqualsTomorrow gets false.
Dim todayEqualsTomorrow As Boolean = System.DateTime.Equals ( today1, tomorrow ) |
|
C# |
VB |
DateTime Members DateTime.Equals Overload List Compare CompareTo