Java Calendar Different getTimeDiffSecond(Calendar first, Calendar second)

Here you can find the source of getTimeDiffSecond(Calendar first, Calendar second)

Description

get Time Diff Second

License

Apache License

Declaration

public static double getTimeDiffSecond(Calendar first, Calendar second) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    public static double getTimeDiffSecond(Calendar first, Calendar second) {
        if (first == null || second == null)
            return 0;
        final double millis = second.getTimeInMillis() - first.getTimeInMillis();
        return Math.abs(millis / 1000);
    }/*from w ww. ja va 2  s  .c om*/
}

Related

  1. getMillisDiff(long lhs, long rhs, int gregorianCalendarUnits)
  2. getMonthDiff(Calendar c1, Calendar c2)
  3. getMonthsDifference(Calendar date1, Calendar date2)
  4. getTargetDate(Calendar reqCal, int diffMon, int proxyDay)
  5. getTimeDifference(String unit, Calendar start, Calendar end)
  6. getWeekDifference(Calendar before, Calendar after)
  7. getYearDifference(GregorianCalendar fromCalendar, GregorianCalendar toCalendar)
  8. millisDiff(Calendar c1, Calendar c2)
  9. minutesDiff(Calendar c1, Calendar c2)