So, I'm trying to basically take 2 DateTime objects and set them to the first day of their respective months so that I can ultimately calculate the months between the two dates.
Example of the code:
DateTime dt = new DateTime();
DateTime newDT = dt.withDayOfMonth(1);
method lookup failed for selector "withDayOfMonth" with signature "(I)Lorg/joda/time/DateTime;"
A possible way to do so, using another method for Joda-Time API which is present in 1.2.1 version it's the follow:
DateTime dateTime = new DateTime().dayOfMonth().withMinimumValue();
Another approach could be to use jdk
Calendar to set the first day of the month for a date. And then get the joda
DateTime(Calendar cal) constructor:
Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); DateTime dateTime = new DateTime(cal);
However probably as other answer suggest the best you can do is update your Joda-Time version.