Java Date Difference differenceDay(Date toDate, Date fromDate)

Here you can find the source of differenceDay(Date toDate, Date fromDate)

Description

difference Day

License

Open Source License

Declaration

public static int differenceDay(Date toDate, Date fromDate) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static int differenceDay(Date toDate, Date fromDate) {
        Calendar to = Calendar.getInstance();
        to.setTime(toDate);/*from www  .ja  v  a  2s. co  m*/
        Calendar from = Calendar.getInstance();
        from.setTime(fromDate);

        long day = (to.getTimeInMillis() - from.getTimeInMillis()) / 1000 / 60 / 60 / 24;
        return (int) day;
    }
}

Related

  1. diffDay(Date date1, Date date2)
  2. diffDay(Date start, Date end)
  3. diffDay(Date startDate, Date endDate)
  4. differDays(Date src, Date target)
  5. difference(Date date1, Date date2)
  6. DifferenceInMilliseconds(Date date1, Date date2)
  7. differenceInMonths(Date beginningDate, Date endingDate)
  8. DifferenceInSeconds(Date date1, Date date2)
  9. differenceMonth(Date date1, Date date2)