Here you can find the source of getSubSeconds(Date minuendDate, Date subDate)
public static int getSubSeconds(Date minuendDate, Date subDate)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int getSubSeconds(Date minuendDate, Date subDate) { Calendar minuend = Calendar.getInstance(); minuend.setTime(minuendDate);/* w w w .j a v a2 s . c o m*/ Calendar sub = Calendar.getInstance(); sub.setTime(subDate); return minuend.get(Calendar.SECOND) - sub.get(Calendar.SECOND); } }