Here you can find the source of diffWeeks(Date start, Date end)
public static int diffWeeks(Date start, Date end)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { /**// ww w . ja v a 2s. c om * Number of weeks difference between two dates * * @return difference in weeks */ public static int diffWeeks(Date start, Date end) { if (start == null || end == null) { return -1; } return (int) ((end.getTime() - start.getTime()) / (1000 * 60 * 60 * 24 * 7) + 1); } /** * Number of weeks difference between two dates * * @return difference in weeks */ public static int diffWeeks(Calendar start, Calendar end) { return diffWeeks(start.getTime(), end.getTime()); } }