Java TimeUnit Usage calculateDaysBetween(final Calendar start, final Calendar end)

Here you can find the source of calculateDaysBetween(final Calendar start, final Calendar end)

Description

calculate Days Between

License

Open Source License

Declaration

public static int calculateDaysBetween(final Calendar start, final Calendar end) 

Method Source Code

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

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

import java.util.concurrent.TimeUnit;

public class Main {
    public static int calculateDaysBetween(final Calendar start, final Calendar end) {
        final Date startDate = start.getTime();
        final Date endDate = end.getTime();
        long milliseconds = (endDate.getTime() - startDate.getTime()) % (1000l * 60l * 60l * 24l);
        return (int) TimeUnit.MILLISECONDS.toMinutes(milliseconds);
    }//w w  w. jav  a  2  s  . c o m
}

Related

  1. age(long creationDate)
  2. areEqualTTL(final Integer ttlDuration1, final Integer ttlDuration2)
  3. calculateRuntime(long startTime, long endTime)
  4. calculateTime(final int seconds)
  5. calculateTime(float seconds)
  6. cancelledFuture()