// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Date;

public class AMPM {
    public static void main(String[] args) {
        Date d1 = new Date();
        Date d2 = new Date(d1.getTime() + 12*60*60*1000L);
        SimpleDateFormat sdf = new SimpleDateFormat("hh:mm a");
        System.out.println(sdf.format(d1));
        System.out.println(sdf.format(d2));
        DateFormatSymbols sym = sdf.getDateFormatSymbols();
        sym.setAmPmStrings(new String[] { "am", "pm" });
        sdf.setDateFormatSymbols(sym);
        System.out.println(sdf.format(d1));
        System.out.println(sdf.format(d2));
    }
}
