Here you can find the source of isSameDay(final Calendar date1, final Calendar date2)
private static boolean isSameDay(final Calendar date1, final Calendar date2)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009 Lifeform Software. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*w w w . j a v a 2 s. c om*/ * Ernan Hughes - initial API and implementation *******************************************************************************/ import java.util.Calendar; public class Main { private static final int miliPerDay = 60 * 60 * 24 * 1000; private static boolean isSameDay(final Calendar date1, final Calendar date2) { return getDaysBetween(date1, date2) < miliPerDay; } public static double getDaysBetween(final Calendar start, final Calendar end) { return getDaysBetween(start.getTimeInMillis(), end.getTimeInMillis()); } public static double getDaysBetween(final long start, final long end) { int days = (int) ((end - start) / miliPerDay); return days; } }