What part of this are you having trouble with? Where are you stuck? How are you storing the dates in your code? Where is your small example program? (Not your whole project, just an SSCCE)