Here you can find the source of getDaysBetween(Calendar firstDate, Calendar lastDate)
Parameter | Description |
---|---|
firstDate | The first date |
lastDate | The second date |
@Deprecated public static int getDaysBetween(Calendar firstDate, Calendar lastDate)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { /**//from w ww . j a v a 2 s. co m * The number of milliseconds in a day */ public static final long MILLIS_PER_DAY = 86400000; /** * Return the number of whole days between two dates * @param firstDate The first date * @param lastDate The second date * @return The number of days' difference */ @Deprecated public static int getDaysBetween(Calendar firstDate, Calendar lastDate) { long diffMillis = lastDate.getTimeInMillis() - firstDate.getTimeInMillis(); return (int) Math.floorDiv(diffMillis, MILLIS_PER_DAY); } }