Julian Date format 20202800234036
The first four-digit are year -2020
and 356 is the day of the year.
what will be the format for this in mysql to achieve it after taking in 7 first values.
Julian Date format 20202800234036
The first four-digit are year -2020
and 356 is the day of the year.
what will be the format for this in mysql to achieve it after taking in 7 first values.
You're looking for str_to_date('2020356','%Y%j')
(gives 2020-12-21) , where %Y
is the format specifier for a four-digit year, and %j
is the day of the year.
For the longer date referenced in your question, just take the LEFT('20202800234036',7)
and apply STR_TO_DATE()` to that:
str_to_date(LEFT('20202800234036',7),'%Y%j') -- 2020-10-06
There's a reference for these formats here