Here you can find the source of getHour()
public static String getHour()
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w w w .j av a 2 s. c o m*/ * Get the current hour * @return The current hour */ public static String getHour() { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("HH"); String output = format.format(date); return output; } }