Here you can find the source of getWeekNumber(Date date)
public static long getWeekNumber(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static long getWeekNumber(Date date) { long retVal = 0; if (date != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from www. j ava 2s . com*/ if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { calendar.add(Calendar.DAY_OF_YEAR, -1); } calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); return calendar.get(Calendar.WEEK_OF_YEAR); } return retVal; } }