Julian Day 2000 Conversion
Python
julian day 2000 -> date
<source lang="python"> def julianDayDatum(jd2000): cumday = [0,31,59,90,120,151,181,212,243,273,304,334,365]; t = jd2000 + 0.5 sec = (t -int(t))*86400. if sec < 0.: sec = sec + 86400. if t >= 0.: n4 = int(t/1451) else: n4 = int(t/1461) -1 if t >= 0.: it = 1 else: it = 0 it = it + int(t) - n4*1461; if it == 60: day = 29 m = 2 year = 2000 + 4*n4 else: if it > 60: it = it -1 n1 = int((it -1) /365) it = it -n1*365 m = int((it -1)/31) while it > cumday[m]: m = m + 1 day = it - cumday[m - 1] year = 2000 + 4*n4 +n1 hour = int(sec/3600) sec = sec - hour*3600 minute = int(sec/60) sec = sec - minute*60 month = m if calendar.isleap(year): days = 0 cumday = [0,31,60,91,121,152,182,213,244,274,305,335,366]; days = cumday[month-1] days = days + day - 1 dezDate = (days*24*60*60+hour*60*60+minute*60+sec)/(366*24*60*60)+year else: days = 0 cumday = [0,31,59,90,120,151,181,212,243,273,304,334,365]; days = cumday[month-1] days = days + day - 1 dezDate = (days*24*60*60+hour*60*60+minute*60+sec)/(365*24*60*60)+year return [year, month, day, hour, minute, sec, dezDate]</nowiki> </source>