Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { /** * returns 1 if calendar1 > calendar2 0 if calendar1 = calendar2 (same day * only) -1 if calendar1 > calendar2 * * @param calendar1 * @param calendar2 */ public static byte compareOnlyDay(Calendar calendar1, Calendar calendar2) { byte dayBefore = 0; int findDiff = 0;// findDiff = calendar1.get(Calendar.DAY_OF_MONTH) - calendar2.get(Calendar.DAY_OF_MONTH); if (findDiff > 0) { dayBefore = 1; } else if (findDiff < 0) { dayBefore = -1; } else { dayBefore = 0; } return dayBefore; } }