Author: Tomas Rutkauskas How to obtain the Julian date Answer: 1 function julian(year, month, day: Integer): real; 2 var 3 yr, mth: Integer; 4 noleap, leap, days, yrs: Real; 5 begin 6 if year < 0 then 7 yr := year + 1 8 else 9 yr := year; 10 mth := month; 11 if (month < 3) then 12 begin 13 mth := mth + 12; 14 yr := yr - 1; 15 end; 16 yrs := 365.25 * yr; 17 if ((yrs < 0) and (frac(yrs) <> 0)) then 18 yrs := int(yrs) - 1 19 else 20 yrs := int(yrs); 21 days := int(yrs) + int(30.6001 * (mth + 1)) + day - 723244.0; 22 if days < -145068.0 then 23 julian := days 24 else 25 begin 26 yrs := yr / 100.0; 27 if ((yrs < 0) and (frac(yrs) <> 0)) then 28 yrs := int(yrs) - 1; 29 noleap := int(yrs); 30 yrs := noleap / 4.0; 31 if ((yrs < 0) and (frac(yrs) <> 0)) then 32 yrs := int(yrs) - 1; 33 leap := 2 - noleap + int(yrs); 34 julian := days + leap; 35 end; 36 end;