开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜