Here you can find the source of monthEquals(Date current, Date compare)
public static boolean monthEquals(Date current, Date compare)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static boolean monthEquals(Date current, Date compare) { Calendar curr = Calendar.getInstance(); curr.setTime(current);/*w w w .jav a2 s .co m*/ Calendar cmp = Calendar.getInstance(); cmp.setTime(compare); int year1 = curr.get(1); int year2 = cmp.get(1); int month1 = curr.get(2); int month2 = cmp.get(2); return (year1 == year2) && (month1 == month2); } }