Minimal Days In First Week of the Year in Java

I am actually going through the utility class Calender. I find myself confused with,

The methods

getFirstDayOfWeek() 
returns the first day of the week;
e.g., SUNDAY in the U.S., MONDAY in France.

and

getMinimalDaysInFirstWeek()
returns the minimal days required in the first week of the year. e.g., 
if the first week is defined as one that contains the first day of the
first month of a year, this method returns 1. If the minimal days required
must be a full week, this method returns 7.

I am living in India (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi. Daylight Saving time is not observed in this time zone.

To get the Week of the year, i coded like this

Calendar calendar = Calendar.getInstance();
System.out.println(calendar.get(Calendar.WEEK_OF_YEAR));   // returns 45 

45 is only possible if Java treats

WeekNumber   FromDate                       ToDate
Week 01      December 30, 2013              January 5, 2014  // December 30 is Monday
Week 45      November 3, 2014(Monday)       November 9, 2014

Does Java takes minimal days to be a full week to be 7? Because I can change it through setMinimalDaysInFirstWeek(). And what effect will it have?

Jon Skeet
people
quotationmark

It's relevant for the number of days in a week of the week-year. Unless you're interested in week-years, it's probably irrelevant to you. By default I'd expect it to be 4, as that's the normal ISO-8601 value.

I don't know for sure whether that interacts with the "first day of week" part - you'd need to check, but it sounds like it does. It shouldn't have anything to do with your time zone.

But for example, week-year 2014 starts on December 30th 2013 precisely because that gives 5 days in 2014. If you look at some other years, you'll find ones where the first couple of days of January calendar year X are in week 52 or week 53 of week-year X-1.

people

See more on this question at Stackoverflow