Here you can find the source of getHourOfDay(Calendar date)
public static String getHourOfDay(Calendar date)
//package com.java2s; //License from project: Open Source License import java.text.DecimalFormat; import java.util.Calendar; public class Main { private static DecimalFormat HOUR_FORMATTER = new DecimalFormat("00"); /**//from w w w . ja v a 2 s .com * gets the hour-of-day of the given date */ public static String getHourOfDay(Calendar date) { String hourOfDay = HOUR_FORMATTER.format(date.get(Calendar.HOUR_OF_DAY)); return hourOfDay; } }