Date Literals

 
Syntax

 

date_literal.bmp

 

YEAR:

 

four_digit_literal.bmp

 

MONTH:

 

two_digit_literal.bmp

 

DAY:

 

two_digit_literal.bmp

 

DATE SEPARATOR:

 

date_separator.bmp

 

A date literal has the format:

 

{d 'YYYY[- | / | .]MM[- | / | .]DD' }

 

where YYYY is the four digit year, MM is the one or two digit month of the year (between 1 and 12), and DD is the one or two digit day of the month (between 1 and 31).

  • CONNX does not assume the date is in the current century if YYYY has two digits. For example, the literal {d '02-01-14'} refers to the year 2 C.E., not 2002 C.E. or 1902 C.E.

  • Date literals have a Date SQL type.

  • When a character literal is used in an expression that expects a date, CONNX will assume the supplied character string is a date literal, even without the date literal prefix '{d' and suffix '}'.

 

Examples of valid date literals:

 

Literal

Validity

{d '2014-03-01' }

valid

{d '1920-12-20' }

valid

{d '1920.12.20' }

valid

{d '1950/1/20' }

valid

{d '1920-12-20' }

valid

{d '2014-13-01' }

invalid month

{d '1920-12-99' }

invalid day