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.

Read syntax diagram
>>-JULIAN_DAY(expression)--------------------------------------><

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.

Start of changeIf 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.End of change

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.

Example 1: Using sample table DSN8A10.EMP, set the integer host variable JDAY to the Julian day of the day that Christine Haas (EMPNO = '000010') was employed (HIREDATE = '1965-01-01').
   SELECT JULIAN_DAY(HIREDATE)
     INTO :JDAY
     FROM DSN8A10.EMP
     WHERE EMPNO = '000010';
The result is that JDAY is set to 2438762.
Example 2: Set integer host variable JDAY to the Julian day for January 1, 1998.
   SELECT JULIAN_DAY('1998-01-01')
     INTO :JDAY
     FROM SYSIBM.SYSDUMMY1;
The result is that JDAY is set to 2450815.
Start of changeExample 3: The following invocations of the JULIAN_DAY function returns the same result:
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.End of change

Start of changeWhen 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.End of change