Compartir a través de


COleDateTimeSpan Relational Operators

Comparison operators.

bool operator ==(
   const COleDateTimeSpan& dateSpan 
) const throw( );
bool operator !=(
   const COleDateTimeSpan& dateSpan 
) const throw( );
bool operator <(
   const COleDateTimeSpan& dateSpan 
) const throw( );
bool operator >(
   const COleDateTimeSpan& dateSpan 
) const throw( );
bool operator <=(
   const COleDateTimeSpan& dateSpan 
) const throw( );
bool operator >=(
   const COleDateTimeSpan& dateSpan 
) const throw( );

Parameters

  • dateSpan
    The COleDateTimeSpan to compare.

Return Value

These operators compare two date/time-span values and return true if the condition is true; otherwise false.

Remarks

Nota

An ATLASSERT will occur if either operand is invalid.

Example

COleDateTimeSpan spanOne(3, 12, 0, 0); // 3 days and 12 hours
COleDateTimeSpan spanTwo(spanOne);     // 3 days and 12 hours
BOOL b;
b = spanOne == spanTwo;                // TRUE
b = spanOne < spanTwo;                 // FALSE, same value
b = spanOne > spanTwo;                 // FALSE, same value
b = spanOne <= spanTwo;                // TRUE, same value
b = spanOne >= spanTwo;                // TRUE, same value   

spanTwo.SetStatus(COleDateTimeSpan::invalid);
b = spanOne == spanTwo;                // FALSE, different status
b = spanOne != spanTwo;                // TRUE, different status
COleDateTimeSpan ts1(100.0);   // one hundred days
COleDateTimeSpan ts2(110.0);   // ten more days

ASSERT((ts1 != ts2) && (ts1 < ts2) && (ts1 <= ts2));   

Requirements

Header: atlcomtime.h

See Also

Reference

COleDateTimeSpan Class

Hierarchy Chart

Other Resources

COleDateTimeSpan Members