Java Day Between getDifferDays(Date d1, Date d2)

Here you can find the source of getDifferDays(Date d1, Date d2)

Description

get Differ Days

License

Apache License

Declaration

public static synchronized long getDifferDays(Date d1, Date d2) 

Method Source Code


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

import java.text.*;
import java.util.*;

public class Main {

    public static synchronized long getDifferDays(Date d1, Date d2) {
        DateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        /*Date d1 = new Date();
        Date d2 = df1.parse("2016-08-01 10:50:24");*/
        long diff = d1.getTime() - d2.getTime();
        long days = diff / (1000 * 60 * 60 * 24);
        return days;
    }/*from ww w  .java2  s  . co m*/
}

Related

  1. getDaysDiff(Date startDate, Date endDate)
  2. getDaysDifference(final Date begin, final Date end)
  3. getDiffBetweenQuarter(Date latestDate, Date current)
  4. getDiffDays(Date date1, Date date2)
  5. getDiffDays(String startDate, String endDate)
  6. getDifferDays(String date1, String date2)
  7. getDifference(Date d1, Date d2)
  8. getDifferenceInDays(final Date startDate, final Date endDate)
  9. getDifferenceOfDays(String dateFromStr, String dateToStr, String dateFormat)