Starting Date $CalendarTable1 | Ending Date $PastFuture $CalendarTable2 |

Computing The Date N Days In The Past Or Future
Given any arbitrary starting date and calendar mode ( ymdA, CalMode), we may want to know what the ending calendar date (ISOymdB) was or will be (±N) in the relative past or future. To do this, we combine the JD computation function with the inverse JD function.
- First, compute the simple JD number for the starting date (
**JDA**). - Then apply ±
**N**days to the JD of the starting date (**JDA**) to obtain the JD of the ending date (**JDB**). - Finally, call the inverse JD function to compute the ISO integer-encoded end date (
**ISOymdB**) corresponding to (**JDB**,**CalMode**).
Algorithm 8:
Given starting date and calendar mode (ISOymdA, CalMode), compute the calendar date (ISOymdB) ±N day(s) in relative past or future. JDA = JD_For_ISOymd (ISOymdA, CalMode) JDB = JDA + N ISOymdB = ISOymd_For_JD (JDB, CalMode) EXAMPLE:Given the starting date of July 4th, 1776 (Gregorian), what was the calendar date exactly
(N = 10987) days later? CalMode = 1 (Gregorian) ISOymdA = 17760704 = July 4th, 1776 AD, for which JDA = 2369916 JDB = Then, given JDB = 2380903, the inverse JD function returns:ISOymdB = 18060804 (August 4th, 1806 AD)
So, the Gregorian calendar date exactly +10987 days from July 4th, 1776 was August 4th, 1806. |