I want to get date and time format in python from Julian day. I have an hdf file t1.15008.0239.mod07.hdf
and I have tried to convert Julian day '15008'
to datetime
like this:
def julday_to_masehi(julday):
file_date= julday
file_date = datetime.strptime(file_date, '%y%j')
file_date = file_date.strftime('%Y-%m-%d')
return file_date
julday = '15232'
datetimee = julday_to_masehi(julday)
print(datetimee)
and the result is 2015-08-20
.
But I also need the time. If I try julday = '150080239'
and change
the to code to: file_date = file_date.strftime('%Y-%m-%d %H:%M:%S')
, then
I get an error.
So how can I convert Julian day '150080239'
into python
datetime
in format '%Y-%m-%d %H:%M:%S'
?