Joda-time: First day in this year's ISO week 1

烈酒焚心 提交于 2019-12-22 03:21:15

问题


I would like to find out the date of the Monday in this year's ISO week 1 (For 2009 this would be Monday, Dec 29 2008).

I'm sure that joda-time can handle this, but I just can't figure out the API (maybe it's just too late).

Can anyone help? Thanks!


回答1:


I believe this should work:

DateMidnight date = new DateMidnight().withWeekOfWeekyear(1).withDayOfWeek(1);



回答2:


The DateMidnight API mentioned in the other answer is now deprecated, use below:

DateTime date = new DateTime().dayOfYear().withMinimumValue().withTimeAtStartOfDay();


来源:https://stackoverflow.com/questions/835895/joda-time-first-day-in-this-years-iso-week-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!