Here you can find the source of getWeekOfYear(Date date)
public static int getWeekOfYear(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int getWeekOfYear(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from ww w. j a va 2 s . co m cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.setFirstDayOfWeek(Calendar.SUNDAY); cal.setMinimalDaysInFirstWeek(1); return cal.get(Calendar.WEEK_OF_YEAR); } }