Java Date Time - 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;
/* ww  w. ja v a  2 s  . com*/
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.