共用方式為


COleDateTimeSpan::operator +, -

加入,減去,並變更 COleDateTimeSpan 值的正負號。

COleDateTimeSpan operator +( 
   const COleDateTimeSpan& dateSpan  
) const throw( ); 
COleDateTimeSpan operator -( 
   const COleDateTimeSpan& dateSpan  
) const throw( ); 
COleDateTimeSpan operator -( ) const throw( );

備註

前兩個運算子可讓您增加和減少日期/時間間隔值。 三個可讓您變更日期/時間間隔值的正負號。

如果運算元都是空的,則產生的 COleDateTimeSpan 值的狀況是空的。

如果運算元無效,其他的則不是空的,則產生的 COleDateTimeSpan 值的狀態無效。

如需有效的詳細資訊,無效和 null 狀態值,請 m_status 成員變數。

範例

COleDateTimeSpan ts1(3, 1, 5, 12); // 3 days, 1 hour, 5 min, and 12 sec
COleDateTimeSpan ts2(100.0 / (24 * 3600.0)); // 100 seconds
COleDateTimeSpan ts3 = ts1 + ts2;
ASSERT(ts3.GetSeconds() == 52); // 6 mins, 52 secs   

需求

Header: atlcomtime.h

請參閱

參考

COleDateTimeSpan Class

階層架構圖表

COleDateTimeSpan::operator +=, -=