Here you can find the source of getDaysBetween(final Calendar start, final Calendar end)
public static double getDaysBetween(final Calendar start, final Calendar end)
//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.java2 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; 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; } }