Is there any Hive
function available to convert from Julian
date to calendar
date?
There are multiple types of Julian
date. The Julian
date I have takes 15001
for 2015-01-01
.
I couldn't find any relevant information on this page:
Is there any Hive
function available to convert from Julian
date to calendar
date?
There are multiple types of Julian
date. The Julian
date I have takes 15001
for 2015-01-01
.
I couldn't find any relevant information on this page:
Just wanted to add.
The below is for julian date format yyyyDDD
Input_julian_date : 2006121
substr(from_unixtime(unix_timestamp(cast(cast(Input_julian_date as int) as string),'yyyyDDD')),1,10)
Output : 2006-05-01
Using "yyyyDDD" correctly converts Julian dates in Hive.
For example, I had a string column like "201707299999ABC" where the first 7 digits were the Julian date:
TO_DATE(FROM_UNIXTIME(UNIX_TIMESTAMP(SUBSTRING(my_julian_column, 0, 7), "yyyyDDD")))
Produces 2017-03-13 as expected.