SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual540440-003
6-64
Datetime Literals
Datetime Literals
SQL/MP Considerations for Datetime Literals
Examples of Datetime Literals
A datetime literal is a DATE, TIME, or TIMESTAMP constant you can use in an
expression, in a statement, or as a parameter value. Datetime literals have the same
range of valid values as the corresponding datetime data types. You cannot use
leading or trailing spaces within a datetime string (within the single quotes)
A datetime literal begins with the DATE, TIME, or TIMESTAMP keyword and can appear
in default, USA, or European format.
date,time,timestamp
specify the datetime literal strings whose component fields are:
SQL/MP Considerations for Datetime Literals
Inserting Into or Updating Any SQL/MP DATETIME Column
DATE 'date' | TIME 'time' | TIMESTAMP 'timestamp'
date is:
yyyy-mm-dd Default
| mm/dd/yyyy USA
| dd.mm.yyyy European
time is:
hh:mm:ss.msssss Default
| hh:mm:ss.msssss [am | pm] USA
| hh.mm.ss.msssss European
timestamp is:
yyyy-mm-dd hh:mm:ss.msssss Default
| mm/dd/yyyy hh:mm:ss.msssss [am | pm] USA
| dd.mm.yyyy hh.mm.ss.msssss European
yyyy Year, from 0001 to 9999
mm Month, from 01 to 12
dd Day, from 01 to 31
hh Hour, from 00 to 23
mm Minute, from 00 to 59
ss Second, from 00 to 59
msssss Microsecond, from 000000 to 999999
am AM or am, indicating time from midnight to before noon
pm PM or pm, indicating time from noon to before midnight