An interesting post about date math. Computing the difference between dates seems like a simple problem. Get an instance at the same time for the two dates. Subtract the time in millis, and divide by millis in a day.This works fine until DST rears it’s ugly head.
Here’s a post with an easy to understand, but not particularly efficient method, and a second more efficient method.
Later in the comments, one poster also suggests enforcing a TimeZone of GMT on the calendar, and this also appears to work.