Here you can find the source of getHour(Date date)
public static String getHour(Date date)
//package com.java2s; import java.text.SimpleDateFormat; public class Main { public static String getHour(Date date) { return FormatDate(date, "HH"); }/*from w ww.ja va 2 s . c o m*/ public static String FormatDate(Date date, String sf) { if (date == null) return ""; SimpleDateFormat dateformat = new SimpleDateFormat(sf); return dateformat.format(date); } }