Date, Time, and Timestamp Escape Sequences

ODBC defines escape sequences for date, time, and timestamp literals. The syntax of these escape sequences is as follows:

{d 'value'}

{t 'value'}

{ts 'value'}

In BNF notation, the syntax is as follows:

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…]

The date, time, and timestamp literal escape sequences are supported if the date, time, and timestamp data types are supported by the data source. An application should call SQLGetTypeInfo to determine whether these data types are supported.