Java Calendar Different timeDiff(Calendar c1, Calendar c2)

Here you can find the source of timeDiff(Calendar c1, Calendar c2)

Description

Diffs two Calendar instances (C2 - C1)

License

Open Source License

Parameter

Parameter Description
c1 a parameter
c2 a parameter

Return

Difference in milliseconds (C2 - C1)

Declaration

public static long timeDiff(Calendar c1, Calendar c2) 

Method Source Code

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

import java.util.Calendar;

public class Main {
    /**// w ww.ja  v a  2  s .co m
     * Diffs two Calendar instances (C2 - C1)
     * 
     * @param c1
     * @param c2
     * @return         Difference in milliseconds (C2 - C1)
     */
    public static long timeDiff(Calendar c1, Calendar c2) {
        return (c2.getTimeInMillis() - c1.getTimeInMillis()) / 1000;
    }
}

Related

  1. getWeekDifference(Calendar before, Calendar after)
  2. getYearDifference(GregorianCalendar fromCalendar, GregorianCalendar toCalendar)
  3. millisDiff(Calendar c1, Calendar c2)
  4. minutesDiff(Calendar c1, Calendar c2)
  5. reduceAndCorrect(Calendar start, Calendar end, int field, int difference)