Java TimeUnit Usage getDifferenceDays(Date d1, Date d2)

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

Description

get Difference Days

License

Open Source License

Declaration

public static long getDifferenceDays(Date d1, Date d2) 

Method Source Code


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

import java.util.Date;
import java.util.concurrent.TimeUnit;

public class Main {
    public static long getDifferenceDays(Date d1, Date d2) {
        long diff = d2.getTime() - d1.getTime();
        return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);
    }//from   ww  w. j  ava  2 s. c om
}

Related

  1. getDateWithoutTime(final Calendar calendar)
  2. getDayFromTimestamp(final long unixTimestamp)
  3. getDays(final long ms)
  4. getDays(long endTs, Long lookback)
  5. getDeltaBetweenTimestamps(final long start, final long end)
  6. getDiffInMinutes(Calendar startTime, Calendar endTime)
  7. getDurationBreakdown(long millis)
  8. getDurationBreakdown(long millis)
  9. getDurationBreakdown(long millis)