Java Hour getHour()

Here you can find the source of getHour()

Description

get Hour

License

Open Source License

Declaration

public static int getHour() 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static int getHour() {
        Calendar cpcalendar = new GregorianCalendar();
        cpcalendar.setTime(getDate());//from   w  w  w  .  ja v  a2s.  co  m
        return cpcalendar.get(Calendar.HOUR_OF_DAY);
    }

    public static int getHour(Date date) {
        Calendar cpcalendar = new GregorianCalendar();
        cpcalendar.setTime(date);
        return cpcalendar.get(Calendar.HOUR_OF_DAY);
    }

    public static int getHour(long date) {
        return getHour(getDate(date));
    }

    public static Date getDate() {
        return Calendar.getInstance().getTime();
    }

    public static Date getDate(long l) {
        return new Date(l);
    }

    public static Date getDate(Date date, long lauchtime) {
        return new Date(date.getTime() + lauchtime);
    }

    public static long getTime() {
        return Calendar.getInstance().getTimeInMillis();
    }
}

Related

  1. getGMTHour(int localHour)
  2. getHexString(byte[] raw)
  3. getHour()
  4. getHour()
  5. getHour()
  6. getHour()
  7. getHour()
  8. getHour()
  9. getHour()