Here you can find the source of weekFromBinStart(Calendar date)
public static int weekFromBinStart(Calendar date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.GregorianCalendar; public class Main { private static long numberOfMSInADay = 1000 * 60 * 60 * 24; public static Calendar startDateForBinning = new GregorianCalendar(2009, 0, 3); public static int weekFromBinStart(Calendar date) { return numberOfDaysBetween(startDateForBinning, date) / 7; }//from w w w .j a v a 2 s .co m public static int numberOfDaysBetween(Calendar start, Calendar end) { long span = end.getTimeInMillis() - start.getTimeInMillis(); return (int) (span / numberOfMSInADay); } }