Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { /** * * @param c1 * @param c2 * @return */ public static boolean isSameMonth(Calendar c1, Calendar c2) { return !(c1 == null || c2 == null) && (c1.get(Calendar.ERA) == c2.get(Calendar.ERA) && (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) && (c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH))); } }