Java Date Difference DifferenceInMilliseconds(Date date1, Date date2)

Here you can find the source of DifferenceInMilliseconds(Date date1, Date date2)

Description

Difference In Milliseconds

License

Open Source License

Declaration

private static double DifferenceInMilliseconds(Date date1, Date date2) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

import java.util.*;

public class Main {
    private static double DifferenceInMilliseconds(Date date1, Date date2) {
        return GetTimeInMilliseconds(date1) - GetTimeInMilliseconds(date2);
    }//from   ww w  . j ava 2  s  .co m

    private static long GetTimeInMilliseconds(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return cal.getTimeInMillis() + cal.getTimeZone().getOffset(cal.getTimeInMillis());
    }
}

Related

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