 <p>Check the javadoc for the <code>set</code> method. You'll see the following:</p> <blockquote> <p>Parameters:</p> <p>year - the value used to set the YEAR calendar field.</p> <p>month - the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January.</p> <p>date - the value used to set the DAY_OF_MONTH calendar field.</p> </blockquote> <p>So your code should become the following:</p> <pre><code>private static int getWeekOfYear(int y, int m, int d) { Calendar cal = Calendar.getInstance(); cal.setMinimalDaysInFirstWeek(4); cal.set(y, m - 1, d); // Note the change here return cal.get(Calendar.WEEK_OF_YEAR); } </code></pre>