Java Date Difference diffDate(java.util.Date date, java.util.Date date1)

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

Description

diff Date

License

Open Source License

Declaration

public static int diffDate(java.util.Date date, java.util.Date date1) 

Method Source Code

//package com.java2s;

public class Main {

    public static int diffDate(java.util.Date date, java.util.Date date1) {
        return (int) ((getMillis(date) - getMillis(date1)) / (24 * 3600 * 1000));
    }//from ww  w .  j a v a 2 s.  c o  m

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

Related

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