www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
datestring, ...
curdate
dateadd
datediff
datestring_gmt
dayname
dayofmonth
dayofweek
dayofyear
dt_set_tz
get_timestamp
getdate
hour
minute
month
monthname
msec_time
now
quarter
second
stringdate
stringtime
timezone
week
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY

Functions Index

stringdate

Convert a string to a datetime
stringdate (in str varchar);
Parameters
str – A varchar date in human-readable (external) format.
Description

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.

Errors
SQLState Error Code Error Text Description
22007 DT006 Cannot convert <offending string> to datetime
22002 DT007 Nulls not allowed as parameters to stringdate

Examples
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.
See Also

datestring

The discussion of TIMESTAMP datatype in section Database Concepts of the documentation.