-
Notifications
You must be signed in to change notification settings - Fork 0
stringdate.md
stringdate - Convert a string to a datetime
**stringdate(in *str *** varchar);
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.
A **varchar ** date in human-readable (external) format.
Table 1. Errors signalled by datestring and stringdate
SQLState | Error Code | Error Text | Description |
22007 | DT006 | Cannot convert <offending string> to datetime | |
22002 | DT007 | Nulls not allowed as parameters to stringdate |
Example 1. Stringdate example with datestring_GMT
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.
**datestring **
The discussion of TIMESTAMP datatype in section Database Concepts of the documentation.
Copyright (C) 1998-2024 OpenLink Software - Virtuoso OpenSource Edition