Here you can find the source of getWeek(java.util.Date date)
public static int getWeek(java.util.Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static int getWeek(java.util.Date date) { java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(date);//from w w w .j a va 2 s . c o m int dayOfWeek = c.get(java.util.Calendar.DAY_OF_WEEK); dayOfWeek = dayOfWeek - 1; if (dayOfWeek == 0) { dayOfWeek = Calendar.DAY_OF_WEEK; } return dayOfWeek; } }