DateTime time=DateTimeFormat.forPattern("yyyy-ww").parseDateTime("2013-01");
其中DateTimeFormat
为org.joda.time.format.DateTimeFormat
。
[执行上述操作时,时间变为2013-12-30T00:00:00.000
我究竟做错了什么?这是错误吗?我希望它是2013年的第一周,而不是最后一周。
请参见here。
w
,周年的周,模式字母应与x
,周年一起使用。从javadoc of DateTimeFormat
DateTimeFormat
将样式更改为
x weekyear year 1996
w week of weekyear number 27
您将解析为
DateTimeFormat.forPattern("xxxx-ww")
根据您的2012-12-31T00:00:00.000-08:00
,2013年的第一周是从2012年开始。