'Remaining Days With Joda Time When Calculating Months
I have the following code snippet that calculates the months between two dates:
import com.github.nscala_time.time.Imports._
import org.joda.time.{DateTime, Days, Interval, Weeks, Months}
import scala.math.Integral.Implicits._
val days = 10
val start = new DateTime(2022, 2, 17, 0, 0, 0, 0)
val end = new DateTime(2022, 4, 30, 0, 0, 0, 0)
val months = Months.monthsBetween(start, end).getMonths
println(months) // Prints 2
Is there an API that I can use to get the remaining days? I'm also not sure how the months are calculated. In this example., it prints 2 months. So what is the basis for calculating this? Does it take 28 days, 30 or 31 days? How does this work?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
