Here you can find the source of getCurrHour()
public static int getCurrHour()
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static int getCurrHour() { Calendar c = Calendar.getInstance(); c.setTime(new Date()); return c.get(Calendar.HOUR_OF_DAY); }// w ww . jav a 2s . c o m }