Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Language Elements : Data types : Literals : Date-time literals : Date literals
 
Date literals
A date literal specifies a day, month, and year using any of the following formats, enclosed in single quotation marks ( ' ' ).

Syntax

This is the syntax for date literals:
{ d'yyyy-mm-dd'}

Parameter

{ d 'yyyy-mm-dd'}
A date literal enclosed in an escape clause is compatible with ODBC. Precede the literal string with an open brace ( { ) and a lowercase d. End the literal with a close brace )}). If you use the ODBC escape clause, you must specify the date using the format yyyy-mm-dd.

Notes

Date literals must be enclosed in single quotations, such as the case with column values in an INSERT statement.

Example

The following example illustrates how to use the date literal format with an INSERT statement:
INSERT INTO dtest VALUES ( { d '2004-05-07' } )
The INSERT and SELECT statements in the following example show some of the supported formats for date literals:
CREATE TABLE T2 (C1 DATE, C2 TIME);
INSERT INTO T2 (C1) VALUES('5/7/56');
INSERT INTO T2 (C1) VALUES('7/MAY/1956');
INSERT INTO T2 (C1) VALUES('1956/05/07');
INSERT INTO T2 (C1) VALUES({d '1956-05-07'});
INSERT INTO T2 (C1) VALUES('29-SEP-1952');
SELECT C1 FROM T2;
--------------
c1
1956-05-07
1956-05-07
1956-05-07
1956-05-07
1952-09-29