FROM_DAYS Function

Description

The FROM_DAYS function returns a date value in DATE type if INTEGER type is inputted as an argument.

It is not recommended to use the FROM_DAYS function for dates prior to the year 1582 because the function does not take dates prior to the introduction of the Gregorian Calendar into account.

If a value in the range of 0 to 3,652,424 can be inputted as an argument. If a value in the range of 0 to 365 is inputted, 0 is returned. 3,652,424, which is the maximum value, means the last day of year 9999.

Syntax

FROM_DAYS(N)

Example

SELECT FROM_DAYS(719528);

   from_days(719528)

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

  01/01/1970

 

SELECT FROM_DAYS('366');

  from_days('366')

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

  01/03/0001

 

SELECT FROM_DAYS(3652424);

   from_days(3652424)

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

  12/31/9999

 

SELECT FROM_DAYS(3652425);

ERROR: Conversion error in date format.

 

SELECT FROM_DAYS(-1);

ERROR: Conversion error in date format.

 

SELECT FROM_DAYS(0);

   from_days(0)

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

    00/00/0000