MAKEDATE Function

Description

The MAKEDATE function returns a date from the specified parameter. You can specify an INTEGER type corresponding to the day of the year in the range of 1 to 9999 as an argument; the value in the range of 1/1/1 to 12/31/9999 is returned in DATE type. If the day of the year has passed the corresponding year, it will become the next year. For example, MAKEDATE(1999, 366) will return 2000-01-01.

However, if you input a value in the range of 0 to 69 as the year, it will be processed as the year 2000-2069, if it is a value in the range of 70 to 99, it will be processed as the year 1970-1999.

If every value specified in year and dayofyear is 0, the return value is determined by the return_null_on_function_errors system parameter; if it is set to yes, then NULL is returned; if it is set to no, an error is returned. The default value is no.

Syntax

MAKEDATE(year, dayofyear)

Example

SELECT MAKEDATE(2010,277);

   makedate(2010, 277)

======================

  10/04/2010

 

SELECT MAKEDATE(10,277);

   makedate(10, 277)

====================

  10/04/2010

 

SELECT MAKEDATE(70,277);

   makedate(70, 277)

====================

  10/04/1970

 

SELECT MAKEDATE(100,3615902);

   makedate(100, 3615902)

=========================

  12/31/9999

 

SELECT MAKEDATE('9999','365');

   makedate('9999', '365')

======================

  12/31/9999

 

SELECT MAKEDATE(9999,366);

ERROR: Conversion error in date format.

 

SELECT MAKEDATE(0,0);

ERROR: Conversion error in date format.