Here you can find the source of getDiffMilliSeconds(Date form, Date to)
public static long getDiffMilliSeconds(Date form, Date to)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static long getDiffMilliSeconds(Date form, Date to) { Calendar cal1 = new GregorianCalendar(); cal1.setTime(form);/*from w w w. ja v a2 s.c o m*/ Calendar cal2 = new GregorianCalendar(); cal2.setTime(to); return (cal1.getTimeInMillis() - cal2.getTimeInMillis()); } }