YEARSTART scalar function

Returns the first day of the year that ADATE exists within, or the first day of the year AYEAR.

Prototypes

YEARSTART(AYEAR INTEGER)
YEARSTART(ADATE DATE)
YEARSTART(ADATE TIMESTAMP)
YEARSTART(ADATE VARCHAR(26))

RETURNS DATE

Description

Returns a DATE representing the first day of AYEAR, or the first day of the year of ADATE depending on the variant of the function that is called.

Parameters

AYEAR
If provided, the year for which to return the starting date.
ADATE
If provided the date in the year for which to return the starting date. Either AYEAR or ADATE must be specified.

Examples

Calculate the starting date of 2010:

VALUES YEARSTART(2010);
1
----------
2010-01-01

Calculate the starting date of the year for the 28th February, 2009:

VALUES YEARSTART('2009-02-28');
1
----------
2009-01-01

See Also