I have spent hours trying to make this next piece of code work.
import org.joda.time.{DateTime, Period}
def dateR
DateTime doesn't have a constructor taking three int arguments, so new DateTime(2012, 06, 30) calls DateTime(Object) constructor with the tuple (2012, 06, 30) as the argument. The documentation says:
Constructs an instance from an
Objectthat represents a datetime.If the object implies a chronology (such as
GregorianCalendardoes), then that chronology will be used. Otherwise, ISO default is used. Thus if aGregorianCalendaris passed in, the chronology used will be GJ, but if a Date is passed in the chronology will be ISO.The recognised object types are defined in
ConverterManagerand includeReadableInstant,String,CalendarandDate. TheStringformats are described byISODateTimeFormat.dateTimeParser().
Unsurprisingly, ConverterManager doesn't know what to do with a Scala tuple, which results in the exception.
If someone can give me a different solution, that would also be great. I want a list of dates from 2000 to 2012, every 6 months.
If you actually want dates, the better type to use is LocalDate (which does have the constructor you want, by the way). If you want DateTime at the start of these dates, then you need to think about what time zone to use.