JULIAN TO GREGORIAN DATE UDF
Last updated
Last updated
This User Defined Function (UDF) is used to transform or cast the Julian date format to a Gregorian date format. Julian dates can be received in three different formats such as JD Edwards World, astronomy or ordinary format.
It returns a string with the Gregorian date format YYYY-MM-DD.
JulianDate: The Julian date to be cast. It can be either CYYDDD (where C is the century) or YYYYDDD.
formatSelected: It represents the format in which the Julian date should be processed. Besides, it is a CHAR and can accept the following formats:
Format available | Letter representation in CHAR | Description |
---|---|---|
Note: The date must be formatted in order to visualize all digits of the year.
Any other format: If the Julian Date is formatted in any other not supported format, there would be differences in the output.
Ranges of B.C. dates may represent inconsistencies due to unsupported Snowflake functions for dates.
No EWIs related.
TO_DATE('2020001', 'J') |
---|
TO_CHAR(TO_DATE('2020001', 'J'), 'YYYY-MON-DD') |
---|
JULIAN_TO_GREGORIAN_DATE_UDF('2020001', 'J') |
---|
Astronomy standardized
'J'
It is the default format. The cast is based in the expected conversion of the Astronomical Applications Department of the US. The Julian Date format for this is YYYYDDD.
JD Edwards World
'E'
The expected Julian date to be received in this case should be CYYDDD (where C represents the century and is operationalized to be added 19 to the corresponding number).
Ordinal dates
'R'
The ordinal dates are an arrangement of numbers which represent a concisely date. The format is YYYYDDD and can be easily read because the year part is not mutable.
18-JUN-18
0818-JUN-18
"0818-06-18"