Here you can find the source of timeDiff(Date date1, Date date2, TimeUnit minutes)
static long timeDiff(Date date1, Date date2, TimeUnit minutes)
//package com.java2s; //License from project: Open Source License import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { static long timeDiff(Date date1, Date date2, TimeUnit minutes) { return minutes.convert(date1.getTime() - date2.getTime(), TimeUnit.MILLISECONDS); }// w w w . j a v a 2 s . c o m }