开发者

Joda Time library in scala returning incorrect date

开发者 https://www.devze.com 2023-02-16 18:19 出处:网络
Im using the joda time library in my scala code. My code is as follows . val dt:Dat开发者_JAVA技巧eTime = new DateTime()

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

精彩评论

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