How do I get the maximum number of weeks for a particular year with Joda-Time?
new DateTime().withYear(PARTICULAR_YEAR).weekOfWeekyear().getMaximumValue();
@cody Comment
Difference between the two methods
.withWeekOfWeekyear()
and.withWeekyear()
Example
new DateTime().withDate(2011, 1, 2);
2/1/2011 : Sunday, last day of last week of 2010 (27/12/2010 - 2/1/2011)
dayOfWeek : 7
weekOfWeekyear : 52
weekyear : 2010
new DateTime().withDate(2011, 1, 3);
3/1/2011 : Monday, first day of first week of 2011 (3/1/2011 - 9/1/2011)
dayOfWeek : 1
weekOfWeekyear : 1
weekyear : 2011