DATE scalar function

Returns a DATE constructed from the specified year, month and day (or day of year).

Prototypes

DATE(AYEAR INTEGER, AMONTH INTEGER, ADAY INTEGER)
DATE(AYEAR INTEGER, ADOY INTEGER)

RETURNS DATE

Description

Returns the DATE value with the components specified by AYEAR, AMONTH and ADAY, or alternatively AYEAR and ADOY the latter of which is the day of year to construct a DATE for.

Parameters

AYEAR
Specifies the year component of the resulting date.
AMONTH
If provided, specifies the month component of the resulting date.
ADAY
If provided, specifies the day (of month) component of the resulting date.
ADOY
If provided, specifies the day of year from which the month and day components of the resulting date will be calculated (the first day of a year is numbered 1).

Examples

Construct a date for first day in February, 2010:

VALUES DATE(2010, 2, 1);
1
----------
2010-02-01

Construct a date for the 180th day of 2009:

VALUES DATE(2009, 180);
1
----------
2009-06-29

See Also