All 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:
-
COleDateTime( ) Constructs a COleDateTime object initialized to 0 (midnight, 30 December 1899).
-
COleDateTime( dateSrc ) Constructs a COleDateTime object from an existing COleDateTime object.
-
COleDateTime( varSrc ) Constructs a COleDateTime object. Attempts to convert a VARIANT structure or COleVariant object to a date/time (VT_DATE) value. If this conversion is successful, the converted value is copied into the new COleDateTime object. If it is not, the value of the COleDateTime object is set to 0 (midnight, 30 December 1899) and its status to invalid.
-
COleDateTime( dtSrc ) Constructs a COleDateTime object from a DATE value.
-
COleDateTime( timeSrc ) Constructs a COleDateTime object from a time_t value.
-
COleDateTime( systimeSrc ) Constructs a COleDateTime object from a SYSTEMTIME value.
-
COleDateTime( filetimeSrc ) Constructs a COleDateTime object from a FILETIME value. . Note that FILETIME uses Universal Coordinated Time (UTC), so if you pass a local time in the structure, your results will be incorrect. See File Times in the Platform SDK for more information.
-
COleDateTime( nYear, nMonth, nDay, nHour, nMin, nSec ) Constructs a COleDateTime object from the specified numerical values.
-
COleDateTime( wDosDate, wDosTime ) Constructs a COleDateTime object from the specified MS-DOS date and time values.
For more information, see the VARIANT entry in the Platform SDK.
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 Platform SDK.
For more information on MS-DOS date and time values, see DosDateTimeToVariantTime in the Platform SDK.
For more information about the bounds for COleDateTime values, see the article Date and Time: Automation Support.
Note |
|---|
| The constructor using DBTIMESTAMP parameter is only available when OLEDB.h is included. |