Java Hour getHour()

Here you can find the source of getHour()

Description

get Hour

License

Open Source License

Declaration

public static Integer getHour() 

Method Source Code

//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);
    }
}

Related

  1. getHour()
  2. getHour()
  3. getHour()
  4. getHour()
  5. getHour()
  6. getHour(boolean military)
  7. getHour(Date begin, Date end)
  8. getHour(Date d)
  9. getHour(Date d)