Here you can find the source of getTimeDiffSecond(Calendar first, Calendar second)
public static double getTimeDiffSecond(Calendar first, Calendar second)
//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*/ }