Here you can find the source of getHour()
public static String getHour() throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String getHour() throws ParseException { Date date = new Date(); SimpleDateFormat formatter; String pattern = "HH"; formatter = new SimpleDateFormat(pattern, new Locale("ko", "KOREA")); return formatter.format(date); }// w ww. j av a 2 s . c o m }