Java Date Time - Java Calendar AM_PM








Syntax

Calendar.AM_PM has the following syntax.

public static final int AM_PM

Example

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

import java.util.Calendar;
import java.util.GregorianCalendar;
//  w  w w  .j  av a  2 s  .c  o m
public class Main {

  public static void main(String[] args) {

    Calendar cal = new GregorianCalendar();   
    System.out.println(cal.getTime());
    
    cal.set( Calendar.AM_PM, Calendar.AM );
    System.out.println(cal.getTime());
    
  }
}

The code above generates the following result.