Create an autolisp program using Meeus's version of converting a Julian
date to dd mm yyyy. The program shall accept one argument (Julian date)
and return the converted Julian date in in the form of a string and
format of dd/mm/yyyy.
Let JD = (getvar "TDCREATE")
1. Add .5 to the JD and let Z = integer part of (JD+.5) and F the
fractional part F = (JD+.5)-Z
2. If Z < 2299161, take A = Z
If Z >= 2299161, calculate alpha = INT((Z-1867216.25)/36524.25)
and A = Z + 1 + alpha - INT(alpha/4).
3. Then calculate:
B = A + 1524
C = INT( (B-122.1)/365.25)
D = INT( 365.25*C )
E = INT( (B-D)/30.6001 )
The day of the month dd (with decimals) is:
dd = B - D - INT(30.6001*E) + F
The month number mm is:
mm = E - 1, if E < 13.5
or
mm = E - 13, if E > 13.5
The year yyyy is:
yyyy = C - 4716 if mm > 2.5
or
yyyy = C - 4715 if mm < 2.5
An example from Meeus' book is for JD = 2436116.31
JD + 0.5 = 2436116.81, so
Z = 2436116
F = 0.81
alpha = INT((2436116 - 1867216.25)/36524.25 ) = 15
A = 2436116 + 1 + 15 - INT(15/4) = 2436129
Then
B = 2437653
C = 6673
D = 2437313
E = 11
So, dd = 4.81, mm = E-1 = 10, and yyyy = C-4716 = 1957, so the date
is:
Oct 4.81, 1957