Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static boolean areEqualMonth(Calendar c1, Calendar c2) { SimpleDateFormat sdf = new SimpleDateFormat("MM-yyyy"); return (sdf.format(c1.getTime()).equals(sdf.format(c2.getTime()))); } }