Here you can find the source of getHour(Date d)
public static int getHour(Date d)
//package com.java2s; //License from project: Artistic License import java.util.Calendar; import java.util.Date; public class Main { public static int getHour(Date d) { return get(d, Calendar.HOUR_OF_DAY); }//from ww w.j a va2 s. co m private static int get(Date d, int field) { Calendar cal = Calendar.getInstance(); cal.setTime(d); return cal.get(field); } }