- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
scala-time question
Mon, 2011-06-20, 15:35
Hi,
I have 2 LocalDates and I want the difference in days between them.
val d1: LocalDate
val d2: LocalDate
The jodatime way of doing this could be:
Days.daysBetween(d1, d2).getDays
I was trying to get some simplification of this using scala-time,
something like:
(d2-d1).days
But d2 -d1 does not compile, gives:
"Multiple markers at this line
- overloaded method value - with alternatives: (builder:
org.scala_tools.time.DurationBuilder)org.joda.time.LocalDate (period:
org.joda.time.ReadablePeriod)org.joda.time.LocalDate cannot be
applied to (org.scala_tools.time.Imports.LocalDate)
- overloaded method value - with alternatives: (builder:
org.scala_tools.time.DurationBuilder)org.joda.time.LocalDate (period:
org.joda.time.ReadablePeriod)org.joda.time.LocalDate cannot be
applied to (org.scala_tools.time.Imports.LocalDate)"
Any advice on this?
Thank you.