Java TimeUnit Calculate getDifference(Calendar initDate, Calendar endDate, TimeUnit units)

Here you can find the source of getDifference(Calendar initDate, Calendar endDate, TimeUnit units)

Description

get Difference

License

Open Source License

Declaration

public static long getDifference(Calendar initDate, Calendar endDate, TimeUnit units) 

Method Source Code

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

import java.util.Calendar;

import java.util.concurrent.TimeUnit;

public class Main {
    public static long getDifference(Calendar initDate, Calendar endDate, TimeUnit units) {
        return units.convert(endDate.getTimeInMillis() - initDate.getTimeInMillis(), TimeUnit.MILLISECONDS);
    }/*from   ww w  . j av a  2  s. co m*/
}

Related

  1. getBucketInMillis(int bucketSize, TimeUnit bucketUnit)
  2. getComingTime(Integer delta, TimeUnit unit)
  3. getDate(final TimeUnit unit, final int offset)
  4. getDateDiff(Date date1, Date date2, TimeUnit timeUnit)
  5. getDateDiff(final Date d1, final Date d2, final TimeUnit timeUnit)
  6. getExpiringMap(long time, TimeUnit unit)
  7. getFragment(final Calendar calendar, final int fragment, final TimeUnit unit)
  8. getFutureDate(long delay, TimeUnit timeUnit)
  9. getInterval(final Date startDate, final Date endDate, final TimeUnit timeUnit)