Java Date Difference diffIntoMilliSecond(java.util.Date date, java.util.Date date1)

Here you can find the source of diffIntoMilliSecond(java.util.Date date, java.util.Date date1)

Description

diff Into Milli Second

License

Apache License

Declaration

public static long diffIntoMilliSecond(java.util.Date date, java.util.Date date1) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    public static long diffIntoMilliSecond(java.util.Date date, java.util.Date date1) {
        if (date == null || date1 == null)
            return 0;
        Calendar cal = Calendar.getInstance();
        cal.setLenient(true);/*from w w w. j av  a  2 s .  com*/
        cal.setTime(date);
        long datet = cal.getTimeInMillis();
        cal.setTime(date1);
        long date1t = cal.getTimeInMillis();
        return datet - date1t;
    }
}

Related

  1. differenceInMonths(Date beginningDate, Date endingDate)
  2. DifferenceInSeconds(Date date1, Date date2)
  3. differenceMonth(Date date1, Date date2)
  4. differenceOnMonth(Date date1, Date date2)
  5. differenceOnYear(Date date1, Date date2)
  6. diffMillis(Date d1, Date d2)
  7. diffMonth(Date before, Date after)
  8. diffMonth(Date start, Date end)
  9. diffOfDate(String begin, String end)