Here you can find the source of monthInRange(Date current, Date before, Date after)
public static boolean monthInRange(Date current, Date before, Date after)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static boolean monthInRange(Date current, Date before, Date after) { Calendar curr = Calendar.getInstance(); curr.setTime(current);/* w w w .j a va2 s . c o m*/ Calendar temp = Calendar.getInstance(); temp.setTime(before); temp.set(5, 1); temp.set(11, 0); temp.set(12, 0); temp.set(13, 0); if (curr.before(temp)) { return false; } temp.setTime(after); temp.add(2, 1); temp.set(5, 1); temp.set(11, 0); temp.set(12, 0); temp.set(13, 0); return !curr.after(temp); } }