Java Calendar HOUR_OF_DAY

Syntax

Calendar.HOUR_OF_DAY has the following syntax.

public static final int HOUR_OF_DAY

Example

In the following code shows how to use Calendar.HOUR_OF_DAY field.


import java.util.Calendar;
//from   w ww .  j av a  2 s  .c  o  m
public class Main {
  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println(now.getTime());

    System.out.println(now.get(Calendar.HOUR_OF_DAY));

  }
}

The code above generates the following result.