posted 4 years ago

I've got to do a fair number of date/calendar calculations using the number of months or weeks between dates. With either Date or Calendar objects, its trivial to get the number of days between to objects, but how do you get the number of months? How do you get the number of weeks? Clearly any discussion of months really requires a Calendar, and in this case, I can easily use a GregorianCalendar

Suppose you have two dates, say October 16, 2012 and January 3, 2012. How many months are they appart?

How do I calculate that they are 41 weeks apart? How can I figure out how many Tuesdays are between them?

Suppose you have two dates, say October 16, 2012 and January 3, 2012. How many months are they appart?

How do I calculate that they are 41 weeks apart? How can I figure out how many Tuesdays are between them?

posted 4 years ago

I've never had occasion to use Joda Time, but I believe it has an Interval class that may (or may not!) be useful here.

edit A quick glance at the JavaDocs suggests that Duration and/or Period may be the useful classes -- not Interval.

edit A quick glance at the JavaDocs suggests that Duration and/or Period may be the useful classes -- not Interval.

luck, db
*There are no new questions, but there may be new answers.*