Java Calendar PM

Syntax

Calendar.PM has the following syntax.

public static final int PM

Example

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


// w  w w .j  a v  a2  s .c  o  m
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.PM );
    System.out.println(cal.getTime());
    
  }
}

The code above generates the following result.