I have two dates in Scala of format 'yyyy-MM-dd' and they both are the last day of a month (2015-05-31) and I want to find the month difference between then. I have the following code but it is not straighforward to find the month difference.
val format = new java.text.SimpleDateFormat("yyyy-MM-dd")
val diff = format.parse(date1).getTime - format.parse(date2).getTime
val days = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS)
Any better suggestion?