Here you can find the source of hoursBetweenDate(Date date1, Date date2)
public static long hoursBetweenDate(Date date1, Date date2)
//package com.java2s; import java.util.Date; public class Main { public static long hoursBetweenDate(Date date1, Date date2) { long d = date1.getTime() - date2.getTime(); return d / 3600000; }//from w w w .j a v a 2 s .c o m }