Partager via


COleDateTimeSpan::COleDateTimeSpan

Constructs a COleDateTimeSpan object.

COleDateTimeSpan( ) throw( ); 
COleDateTimeSpan( 
   double dblSpanSrc  
) throw( ); 
COleDateTimeSpan( 
   LONG lDays, 
   int nHours, 
   int nMins, 
   int nSecs  
) throw( );

Parameters

  • dblSpanSrc
    The number of days to be copied into the new COleDateTimeSpan object.

  • lDays, nHours, nMins, nSecs
    Indicate the day and time values to be copied into the new COleDateTimeSpan object.

Remarks

All of these constructors create new COleDateTimeSpan objects initialized to the specified value. A brief description of each of these constructors follows:

  • COleDateTimeSpan( )   Constructs a COleDateTimeSpan object initialized to 0.

  • COleDateTimeSpan( dblSpanSrc )   Constructs a COleDateTimeSpan object from a floating-point value.

  • COleDateTimeSpan( lDays**,** nHours**,** nMins**,** nSecs )   Constructs a COleDateTimeSpan object initialized to the specified numerical values.

The status of the new COleDateTimeSpan object is set to valid.

For more information about the bounds for COleDateTimeSpan values, see the article Date and Time: Automation Support.

Example

COleDateTimeSpan spanOne(2.75);          // 2 days and 18 hours
COleDateTimeSpan spanTwo(2, 18, 0, 0);   // 2 days and 18 hours
COleDateTimeSpan spanThree(3, -6, 0, 0); // 2 days and 18 hours

COleDateTimeSpan ts1;               // Uninitialized time value
COleDateTimeSpan ts2a(ts1);         // Copy constructor
COleDateTimeSpan ts2b = ts1;         // Copy constructor again
COleDateTimeSpan ts3(100.0);          // 100 days
COleDateTimeSpan ts4(0, 1, 5, 12);   // 1 hour, 5 minutes, and 12 seconds

Requirements

Header: atlcomtime.h

See Also

Reference

COleDateTimeSpan Class

Hierarchy Chart

COleDateTimeSpan::operator =

COleDateTimeSpan::GetStatus

COleDateTimeSpan::m_span

COleDateTimeSpan::m_status