共用方式為


COleDateTimeSpan Relational 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( );

參數

  • dateSpan
    要比較的 COleDateTimeSpan

傳回值

如果條件為 true 時,這些運算子會比較兩個日期/時間間隔值並傳回 true ;否則 false

備註

注意事項注意事項

如果任一個運算元、無效,便會發生。

範例

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));   

需求

Header: atlcomtime.h

請參閱

參考

COleDateTimeSpan Class

階層架構圖表