Here you can find the source of getWeek(Date today)
public static int getWeek(Date today)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static int getWeek(Date today) { Calendar calendar = Calendar.getInstance(); calendar.setTime(today);/* w w w. jav a 2 s .c om*/ // return calendar.get(Calendar.DAY_OF_WEEK)-1; switch (calendar.get(Calendar.DAY_OF_WEEK)) { case 1: return 0; case 2: return 1; case 3: return 2; case 4: return 3; case 5: return 4; case 6: return 5; case 7: return 6; } return 0; } }