| Oracle® Objects for OLE Developer's Guide 11g Release 2 (11.2) for Microsoft Windows Part Number E12245-01 |
|
|
View PDF |
Applies To
Description
Returns a copy of the Date type from an OraTimeStamp or OraTimeStampTZ object.
Usage
Set date = OraTimeStampObj.ToDate Set date = OraTimeStampTZObj.ToDate
Remarks
This method returns the datetime values in the Date data type. As a result, the date-time values can be adjusted if they fall outside the range allowed by a VB date.
For an OraTimeStamp object:
Returns a new Date object with the same date-time values as the current OraTimeStamp object, but the nanosecond portion is truncated.
For an OraTimeStampTZ object:
Returns a new Date object with the same date-time values as the current OraTimeStampTZ object, but the nanosecond portion and time zone portion are truncated.
Examples
Using the OraTimeStamp Object
Dim OraTimeStamp As OraTimeStamp
...
'Create OraTimeStamp using a string
Set OraTimeStamp = OraSession.CreateOraTimeStamp("1999-APR-29 12:10:23.444 AM", _
"YYYY-MON-DD HH:MI:SS.FF AM")
' returns a Date type with date value set to "1999-APR-29 12:10:23 AM"
' note that the fractional part is dropped
Set date = OraTimeStamp.ToDate
Using the OraTimeStampTZ Object
Dim OraTimeStampTZ As OraTimeStampTZ
...
'Create OraTimeStampTZ using a string
Set OraTimeStampTZ = OraSession.CreateOraTimeStampTZ("2000-12-28" & _
"12:10:23.444 -07:00", "YYYY-MM-DD HH:MI:SS.FF TZH:TZM")
'returns a Date type with date value set to "2000-12-28 12:10:23"
'note that Time Zone and nanosecond portions are dropped
Set date = OraTimeStampTZ.ToDate