DATE TO JULIANDAYS UDF
Description
Custom UDF overloads
DATE_TO_JULIANDAYS_UDF(date)
CREATE OR REPLACE FUNCTION PUBLIC.DATE_TO_JULIAN_DAYS_UDF(input_date DATE)
RETURNS NUMBER
IMMUTABLE
AS
$$
DATEDIFF(DAY,TO_DATE('00000101','YYYYMMDD'),TO_DATE('01/01/4712','DD/MM/YYYY')) +
DATEDIFF(DAY,TO_DATE('00000101','YYYYMMDD'),input_date) + 38
// Note: The 38 on the equation marks the differences in days between calendars and must be updated on the year 2099
$$
;Usage Example
Oracle
Snowflake
Known Issues
Related EWIs
Last updated
Was this helpful?