calculate months between two dates in java -


this question has answer here:

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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -