Here you can find the source of getWeeksBetweenDate(Date begin, Date end)
public static int getWeeksBetweenDate(Date begin, Date end)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int getWeeksBetweenDate(Date begin, Date end) { int bWeek = getDateField(begin, Calendar.WEEK_OF_YEAR); int eWeek = getDateField(end, Calendar.WEEK_OF_YEAR); return eWeek - bWeek; }//from w w w. jav a2 s .c om private static int getDateField(Date date, int field) { Calendar c = getCalendar(); c.setTime(date); return c.get(field); } private static Calendar getCalendar() { return Calendar.getInstance(); } public static int get(int field, Date date) { Calendar c = Calendar.getInstance(); c.setTime(date); return c.get(field); } }