Date/time literals
Date/time literals are represented using escape sequences in specific formats as defined by ODBC. The syntax of the escape sequences is as follows:
{d 'value'}
{t 'value'}
{ts 'value'}
Examples in ODBC Syntax
Date Literal:
|
{d '1999-01-01'}
|
Time Literal:
|
{t '8:30:03'}
|
Time Literal with fractional seconds:
|
{t '8:30:03.000001'}
|
Timestamp Literal:
|
{ts '1999-01-01 8:30:03'}
|
ODBC syntax in BNF notation
<ODBC-date-time-escape> ::=
<ODBC-date-escape>
| <ODBC-time-escape>
| <ODBC-timestamp-escape>
<ODBC-date-escape> ::=
<ODBC-esc-initiator> d '<date-value>' <ODBC-esc-terminator>
<ODBC-time-escape> ::=
<ODBC-esc-initiator> t '<time-value>' <ODBC-esc-terminator>
ODBC-timestamp-escape ::=
<ODBC-esc-initiator> ts '<timestamp-value>' <ODBC-esc-terminator>
<ODBC-esc-initiator> ::= {
<ODBC-esc-terminator> ::= }
<date-value> ::= <years-value> <date-separator> <months-value>
<date-separator> <days-value>
<time-value> ::= <hours-value> <time-separator> <minutes-value>
<time-separator> <seconds-value>
<timestamp-value> ::= <date-value> <timestamp-separator> <time-value>
<date-separator> ::= - | /
<time-separator> ::= :
<timestamp-separator> ::=
(The blank character)
<years-value> ::= digit digit digit digit
<months-value> ::= digit digit
<days-value> ::= digit digit
<hours-value> ::= digit digit
<minutes-value> ::= digit digit
<seconds-value> ::= digit digit[.digit...]
Note: Fractional seconds are specified as billionths of seconds (0-999999999).