COleDateTime Relational Operators

BOOL operator ==( const COleDateTime& date ) const;
BOOL operator !=( const COleDateTime& date ) const;
BOOL operator <( const COleDateTime& date ) const;
BOOL operator >( const COleDateTime& date ) const;
BOOL operator <=( const COleDateTime& date ) const;
BOOL operator >=( const COleDateTime& date ) const;

Remarks

These operators compare two date/time values and return nonzero if the condition is true; otherwise 0.

Note   The return value of the ordering operations (<, <=, >, >=) is undefined if the status of either operand is null or invalid. The equality operators (==, !=) consider the status of the operands.

Example

COleDateTime dateOne(95, 3, 15, 12, 0, 0); // 15 March 1995 12 noon
COleDateTime dateTwo(dateOne);             // 15 March 1995 12 noon
BOOL b;
b = dateOne == dateTwo;                    // TRUE

dateTwo.SetStatus(COleDateTime::invalid);
b = dateOne == dateTwo;                    // FALSE, different status
b = dateOne != dateTwo;                    // TRUE, different status
b = dateOne < dateTwo;                     // FALSE, same value
b = dateOne > dateTwo;                     // FALSE, same value
b = dateOne <= dateTwo;                    // TRUE, same value
b = dateOne >= dateTwo;                    // TRUE, same value

Note   The last four lines of the preceding example will ASSERT in debug mode.

COleDateTime OverviewClass MembersHierarchy Chart

See Also   COleDateTime::GetStatus