JULIAN_DAY
The JULIAN_DAY function returns an integer value representing a number of days from January 1, 4713 B.C. (the start of the Julian date calendar) to the date specified in the argument.
- expression
- An expression that returns a value of one of the following built-in data types: a date, a timestamp, a character string, or a graphic string. If expression is a character or graphic string, its value must be a valid string representation of a date or timestamp. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.
The result of the function is a large integer. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
Note
Julian and Gregorian calendar: The transition from the Julian calendar to the Gregorian calendar on 15 October 1582 is not taken into account by this function.
Examples
- Using sample table EMPLOYEE, set the integer host variable JDAY
to the Julian day of the day that Christine Haas (EMPNO = '000010')
was employed (HIREDATE = '1965-01-01').
The result is that JDAY is set to 2438762.SELECT JULIAN_DAY(HIREDATE) INTO :JDAY FROM EMPLOYEE WHERE EMPNO = '000010'
- Set integer host variable JDAY to the Julian day for January 1,
1998.
The result is that JDAY is set to 2450815.SELECT JULIAN_DAY('1998-01-01') INTO :JDAY FROM SYSIBM.SYSDUMMY1