Joda Time library in scala returning incorrect date
Im using the joda time library in my scala code. My code is as follows .
val dt:Dat开发者_JAVA技巧eTime = new DateTime()
val dtf:DateTimeFormatter = DateTimeFormat.forPattern("yyyy-mm-dd")
return dtf.print(dt.minusDays(1))
Assuming the current date is March 11 2011,the above code should return the string 2011-03-10,but the output i get is 2011-52-10
What could be causing this problem ?
Please Help Thank You
In a DateTimeFormat
the pattern mm
is for minutes, use MM
for months.
精彩评论