Java Calendar AM

Syntax

Calendar.AM has the following syntax.

public static final int AM

Example

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


/* w w  w.j  a v a 2s  .  c om*/
import java.util.Calendar;
import java.util.GregorianCalendar;

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.