JULIAN_DAY
The JULIAN_DAY function returns an integer value that represents a number of days from January 1, 4713 B.C. (the start of the Julian date calendar) to the date that is specified in the argument.
The schema is SYSIBM.
The argument must be an expression that returns one of the following data types: a date, a timestamp, or a valid string representation of a date or timestamp. An argument with a character string data type must not be a CLOB. An argument with a graphic string data type must not be a DBCLOB. A string argument must have an actual length that is not greater than 255 bytes. For the valid formats of string representations of dates and timestamps, see String representations of datetime values.
If expression is a timestamp with a time zone, or a valid string representation of a timestamp with a time zone, the result is determined from the UTC representation of the datetime value.
The result of the function is a large integer.
The result can be null; if the argument is null, the result is the null value.
SELECT JULIAN_DAY(HIREDATE)
INTO :JDAY
FROM DSN8A10.EMP
WHERE EMPNO = '000010';
The result is that JDAY is
set to 2438762. SELECT JULIAN_DAY('1998-01-01')
INTO :JDAY
FROM SYSIBM.SYSDUMMY1;
The result is that JDAY is
set to 2450815.SELECT JULIAN_DAY('2003-01-02-20.00.00'),
JULIAN_DAY('2003-01-02-12.00.00-08:00'),
JULIAN_DAY('2003-01-03-05.00.00+09:00')
FROM SYSIBM.SYSDUMMY1;
For each invocation of the JULIAN_DAY
function in this SELECT statement, the result is 2452642.When the input argument contains a time zone, the result is determined from the UTC representation of the input value. The string representations of a timestamp with a time zone in the SELECT statement all have the same UTC representation: 2003-01-02-20.00.00.