Java Date Difference diffDate(Date date, Date date1)

Here you can find the source of diffDate(Date date, Date date1)

Description

diff Date

License

Apache License

Declaration

public static long diffDate(Date date, Date date1) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static long diffDate(Date date, Date date1) {
        return (getMillis(date) - getMillis(date1)) / 86400000L;
    }//from w ww . jav a  2 s  .  co  m

    public static long getMillis(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar.getTimeInMillis();
    }
}

Related

  1. diff(Date subtrahend, Date minuend, long diffField)
  2. diff(int type, Date date1, Date date2)
  3. diff_in_date(Date d1, Date d2, String type)
  4. diffBetweenMonth(Date d1, Date d2)
  5. diffCommercial(Date dateUntil, Date dateFrom, boolean bAddDay)
  6. diffDate(java.util.Date date, java.util.Date date1)
  7. diffDateD(Date sd, Date ed)
  8. diffDateM(Date sd, Date ed)
  9. diffDates(long starttime, long endtime, int type)