Here you can find the source of weekendMinutesBetween(Date date1, Date date2)
public static long weekendMinutesBetween(Date date1, Date date2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { public static long weekendMinutesBetween(Date date1, Date date2) { Calendar date1Calendar = Calendar.getInstance(); date1Calendar.setTime(date1); long weekendMinutes = 0; date1Calendar.add(Calendar.DAY_OF_MONTH, 1); while (date2.after(date1Calendar.getTime())) { if (date1Calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || date1Calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { weekendMinutes += TimeUnit.DAYS.toMinutes(1); }//from www .j a v a 2 s .com date1Calendar.add(Calendar.DAY_OF_MONTH, 1); } return weekendMinutes; } }