Here you can find the source of getHour()
public static Integer getHour()
//package com.java2s; /**/* w w w. ja v a 2 s . co m*/ * Copyright (c)2010-2011 Enterprise Website Content Management System(EWCMS), All rights reserved. * EWCMS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * http://www.ewcms.com */ import java.util.Calendar; import java.util.Date; public class Main { public static Integer getHour() { return getHour(null); } public static Integer getHour(Date time) { Calendar calendar = Calendar.getInstance(); if (time != null) { calendar.setTime(time); } return calendar.get(Calendar.HOUR_OF_DAY); } }