Share via


COleDateTimeSpan::COleDateTimeSpan

These constructors createt and instance of a COleDateTimeSpan object. The default constructor initializes it to zero.

COleDateTimeSpan( ); 

COleDateTimeSpan(
const COleDateTimeSpan& dateSpanSrc ); 

COleDateTimeSpan(
double dblSpanSrc ); 

COleDateTimeSpan(
long lDays,
int nHours,
int nMins,
int nSecs ); 

Parameters

  • dateSpanSrc
    An existing COleDateTimeSpan object to be copied into the new COleDateTimeSpan object.
  • 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

A brief description of each of these constructors follows:

  • COleDateTimeSpan( )   Constructs a COleDateTimeSpan object initialized to zero.
  • COleDateTimeSpan( dateSpanSrc )   Constructs a COleDateTimeSpan object from an existing COleDateTimeSpan object.
  • 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.

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

**  Windows CE versions:** 2.0 and later  
  Header file: Declared in Afxdisp.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

COleDateTimeSpan::GetStatus, COleDateTimeSpan::operator =, COleDateTimeSpan::m_span, COleDateTimeSpan::m_status