Use ACM algorithm #199 "Conversions Between Calendar Date and Julain Day Number". Once you've converted the dates into julian days (number of days since the founding of Rome, for trivia buffs) the arithmetic is trivial. When done, you convert back. The algorithms are fairly short; I can type them in if you don't have the Collected Algorithms available.