CompareTo()

DateTime::CompareTo(DateTime) const method

Compares two date and time values represented by the current object and the specified instance of DateTime class and returns the value indicating values’ relative positions on the time line.

constexpr int System::DateTime::CompareTo(DateTime value) const

Arguments

ParameterTypeDescription
valueDateTimeAn instance of DateTime class to compare the current object with

Return Value

A value that is less than 0 if the current object represents a value that is earlier than that represented by value; 0 if values represented by both objects are the same; a value that is greater than 0 if the value represented by the current object is later than that represented by value

See Also