COleDateTime( );
COleDateTime( const COleDateTime& dateSrc );
COleDateTime( const VARIANT& varSrc );
COleDateTime( DATE dtSrc );
COleDateTime( time_t timeSrc );
COleDateTime( const SYSTEMTIME& systimeSrc );
COleDateTime( const FILETIME& filetimeSrc );
COleDateTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec );
COleDateTime( WORD wDosDate, WORD wDosTime );
Parameters
dateSrc
An existing COleDateTime object to be copied into the new COleDateTime object.
varSrc
An existing VARIANT data structure (possibly a COleVariant object) to be converted to a date/time value (VT_DATE) and copied into the new COleDateTime object.
dtSrc
A date/time (DATE) value to be copied into the new COleDateTime object.
timeSrc
A time_t value to be converted to a date/time value and copied into the new COleDateTime object.
systimeSrc
A SYSTEMTIME structure to be converted to a date/time value and copied into the new COleDateTime object.
filetimeSrc
A FILETIME structure to be converted to a date/time value and copied into the new COleDateTime object.
nYear, nMonth, nDay, nHour, nMin, nSec
Indicate the date and time values to be copied into the new COleDateTime object.
wDosDate, wDosTime
MS-DOS date and time values to be converted to a date/time value and copied into the new COleDateTime object.
Remarks
All of these constructors create new COleDateTime objects initialized to the specified value. The following table shows valid ranges for each date and time component:
Date/Time Component | Valid Range |
year | 100 – 9999 |
month | 0 – 12 |
day | 0 – 31 |
hour | 0 – 23 |
minute | 0 – 59 |
second | 0 – 59 |
Note that the actual upper bound for the day component varies based on the month and year components. For details, see the SetDate or SetDateTime member functions.
Following is a brief description of each constructor:
For more information, see the VARIANT entry in the Win32 SDK OLE Programmer's Reference.
For more information on the time_t data type, see the time function in the Run-Time Library Reference.
For more information, see the SYSTEMTIME and FILETIME structures in the Win32 SDK documentation.
For more information on MS-DOS date and time values, see DosDateTimeToVariantTime in the Win32 SDK documentation.
For more information about the bounds for COleDateTime values, see the article Date and Time: Automation Support in Visual C++ Programmer’s Guide.
Example
time_t osBinaryTime; // C run-time time (defined in <time.h>)
time(&osBinaryTime); // Get the current time from the
// operating system.
COleDateTime time1; // initialized to 00:00am, 30 December 1899
// (and m_nStatus is valid!)
COleDateTime time2 = time1; // Copy constructor
COleDateTime time3(osBinaryTime) // from time_t
COleDateTime time4( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999
SYSTEMTIME sysTime; // Win32 time information
GetSystemTime(&sysTime);
COleDateTime time5(sysTime);
COleDateTime Overview | Class Members | Hierarchy Chart
See Also COleDateTime::SetDate, COleDateTime::SetDateTime, COleDateTime::SetTime, COleDateTime::GetStatus, COleDateTime::operator =, COleDateTime::m_dt, COleDateTime::m_status