calculate months between two dates in java -
this question has answer here:
- java date month difference 16 answers
i need calculate months between 2 dates, if startdate=2013.01.01, enddate=2013.01.31 answer should 1, startdate=2013.01.01, enddate=2013.02.01 answer should 2. please help
use joda months:
datetime start = new datetime(startdate.gettime()); datetime end= new datetime(enddate.gettime()); int months = months.monthbetween(start, end).getmonths();
Comments
Post a Comment