# Converting from Julian Date to Calendar Date? [closed]

Does anyone know of a way to convert from a Julian date to a regular calendar date?

• where did you get this data? :D maybe try a formula here? aa.usno.navy.mil/faq/docs/JD_Formula.php – Alex Tereshenkov Apr 15 '14 at 20:33
• To be honest, I am asking for a friend, and I am not sure if he can disclose it, but I will ask. – Ryan Garnett Apr 15 '14 at 20:36
• I simply never seen any GIS datasets storing data in Julian. :) but perhaps a formula above could help. If not, then I'd go for regular expressions (even though I don't usually recommend those...) – Alex Tereshenkov Apr 15 '14 at 20:38
• Thank you Alex, I will pass it along. I don't see Julian dates either, but there must be some reason as to why they are using it. – Ryan Garnett Apr 15 '14 at 21:27

I take no credit for the following Python snippet, which is taken from an ESRI idea found by Googling 'convert from julian to calendar date arcgis'. As trivia, they mention the data they were working with came from the FAA. There is also mention of data coming over from Excel in that format despite being entered differently.

I apologize if my cut/paste screws up any formatting, nor do I know if it works or needs modification. I have minimal (recent) programming experience but tried to replicate it as best I could in this interface.

``````def julianDateToDate(jDate):
_jdatere = re.compile("(?P<year>\d{4})(?P<days>\d{3})")
match =_jdatere.match(jDate)
if match:
d = match.groupdict()
year = int(d["year"])
days = int(d["days"])
date = datetime.date(year,1,1) + datetime.timedelta(days=days-1)
return date
``````

I am just playing around with this. I found the same site/formula that @Alex Tereshenkov mentioned in the comment above . Here is what my field calculator expression and codeblock look like:

``````def CalcDate(JD):
L= JD+68569
N= 4 * L /146097
L= L - (146097*N+3)/4
I= 4000*(L+1)/1461001
L= L-1461*I/4+31
J= 80*L/2447
K= L-2447*J/80
L= J/11
J= J+2-12*L
I= 100*(N-49)+ I+ L
d = datetime.date(I, J, K)
return d.day

CalcDate( int( !Julian! ) )
``````

...where !Julian! is the field name that I am storing the date values in. Also of note, I am calculating this on a field of data type 'String' and not a field of 'Date' data type.

I am returning "d.day" because for some reason if I return just "d" the field calculates to NULL. According to this site where I got the info on the module..."d" should write in the format "2014-04-14" but just produces NULL values in ARC for reasons I cannot figure out. It works in IDLE, however.

Anyways, this could be a starting point if you decide you calculate this manually.