COleDateTime Relational Operators
Comparison operators.
bool operator ==(
const COleDateTime& date
) const throw( );
bool operator !=(
const COleDateTime& date
) const throw( );
bool operator <(
const COleDateTime& date
) const throw( );
bool operator >(
const COleDateTime& date
) const throw( );
bool operator <=(
const COleDateTime& date
) const throw( );
bool operator >=(
const COleDateTime& date
) const throw( );
Parameters
- date
The COleDateTime object to be compared.
Return values
These operators compare two date/time values and return true if the condition is true; otherwise false.
Remarks
注意
An ATLASSERT will occur if either of the two operands is invalid.
Example
COleDateTime dateOne(1995, 3, 15, 12, 0, 0); // 15 March 1995 12 noon
COleDateTime dateTwo(dateOne); // 15 March 1995 12 noon
BOOL b;
b = dateOne == dateTwo; // TRUE
b = dateOne < dateTwo; // FALSE, same value
b = dateOne > dateTwo; // FALSE, same value
b = dateOne <= dateTwo; // TRUE, same value
b = dateOne >= dateTwo; // TRUE, same value
dateTwo.SetStatus(COleDateTime::invalid);
b = dateOne == dateTwo; // FALSE, different status
b = dateOne != dateTwo; // TRUE, different status
The operators >=, <=, >, and <, will assert if the COleDateTime object is set to null.
VARIANT v = {};
v.vt = VT_NULL;
COleDateTime t1(v);
COleDateTime t2(v);
t1 = t1 + t2;
Requirements
Header: atlcomtime.h