scala 中的 Joda Time 库返回错误的日期
我在我的 scala 代码中使用 joda 时间库。我的代码如下。
val dt:DateTime = new DateTime()
val dtf:DateTimeFormatter = DateTimeFormat.forPattern("yyyy-mm-dd")
return dtf.print(dt.minusDays(1))
假设当前日期是 2011 年 3 月 11 日,上面的代码应该返回字符串 2011-03-10,但我得到的输出是 2011-52-10
是什么导致了这个问题?
请帮忙 谢谢
Im using the joda time library in my scala code. My code is as follows .
val dt:DateTime = 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
DateTimeFormat
模式mm
表示分钟,使用MM
表示几个月。In a
DateTimeFormat
the patternmm
is for minutes, useMM
for months.