Julian day
This is an algorithm by Edward Graham Richards to convert a Julian Day Number, J, to a date in the Gregorian calendar (proleptic, when applicable). Richards states the algorithm is valid for Julian day numbers greater than or equal to 0. All variables are integer values, and the notation ""a" div "b"" indicates integer division, and "mod("a","b")" denotes the modulus operator.