stringdate converts dates and timestamps from text to the internal DATETIME type.
The external format is: YYYY.MM.DD hh:mm.ss uuuuuu where uuuuuu represents number of microseconds.
If trailing parts are omitted from the string given to stringdate, they are assumed to be zero. The three first parts are mandatory. Note that use of cast (x as datetime) is preferred over this function.
| SQLState | Error Code | Error Text | Description |
| 22007 | DT006 | Cannot convert <offending string> to datetime | |
| 22002 | DT007 | Nulls not allowed as parameters to stringdate |
We are at central european time zone CET(GMT+1).
SQL> use Demo;
Done. -- 3 msec.
SQL> select (datestring_GMT (stringdate ('2000-01-01 22:00')));
callret
VARCHAR
_______________________________________________________________________________
2000-01-01 21:00:00.000000
1 Rows. -- 45 msec.
SQL> select left (datestring(ShippedDate), 10) from Orders
where ShippedDate > stringdate ('1996.6.3');
callret
VARCHAR
_______________________________________________________________________________
1996-06-04
1996-06-04
1996-06-05
1996-06-05
1996-06-05
5 Rows. -- 3 msec.
The discussion of TIMESTAMP datatype in section Database Concepts of the documentation.