Here you can find the source of millisecondsBetween(Date start, Date finish)
public static long millisecondsBetween(Date start, Date finish)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**// w w w .j av a 2 s . c o m * Returns the number of milliseconds between the given Dates. */ public static long millisecondsBetween(Date start, Date finish) { Calendar calendar1 = new GregorianCalendar(); calendar1.setTime(start); Calendar calendar2 = new GregorianCalendar(); calendar2.setTime(finish); return calendar2.getTimeInMillis() - calendar1.getTimeInMillis(); } }