In [1]:
## calendar date to Julian date
import pandas as pd
ts = pd.Timestamp('2022-09-11')
ts.to_julian_date()
Out[1]:
2459833.5
In [3]:
## Julian date to calendar date
pd.to_datetime(2459800.5-2459833.5, unit='D',origin=pd.Timestamp('2022-09-11'))
Out[3]:
Timestamp('2022-08-09 00:00:00')
In [4]:
## This is the link to Julian day https://en.wikipedia.org/wiki/Julian_day
# the Julian day number for the day starting at 12:00 UT (noon) on January 1, 2000, was 2 451 545.
pd.to_datetime(2451545-2459833.5, unit='D',origin=pd.Timestamp('2022-09-11'))
Out[4]:
Timestamp('2000-01-01 12:00:00')
In [5]:
pd.to_datetime(2459833.5, unit='D',origin='julian')
Out[5]:
Timestamp('2022-09-11 00:00:00')
In [7]:
ts = pd.Timestamp('2022-09-11 12:00:00')
ts.to_julian_date()
Out[7]:
2459834.0
In [8]:
pd.to_datetime(2459834, unit='D',origin='julian')
Out[8]:
Timestamp('2022-09-11 12:00:00')
In [9]:
pd.to_datetime(2451545, unit='D',origin='julian')
Out[9]:
Timestamp('2000-01-01 12:00:00')
In [ ]: