Can you set AM/PM in a GregorianCalendar date or is it something you can only get
Calendar.get(Calendar.HOUR);
Gives the hour (0-12) for AM/PM format.
Calendar.get(Calendar.HOUR_OF_DAY);
Gives the hour ranging from 0-24.
It does the conversion on its own. You don't need to tell it.
cal.set( Calendar.AM_PM, Calendar.AM )
Will/Could change the point time this calendar object represents. (If it's 1:00PM you will have 1:00AM afterwards). This is true for GregorianCalendar
(see comment to question by Peter Cetinski).
Btw/Hint imo you should use a DateFormat
to ouput your preferred format.
Calendar cal = new GreogorianCalendar();
cal.set( Calendar.AM_PM, Calendar.AM );