Calendar cal = Calendar.getInstance();
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL,
DateFormat.MEDIUM);
// print out the current date and time
System.out.println(df.format(cal.getTime()));
// add 8 days to the current date and print out the date and time
cal.add(Calendar.DATE, 8);
System.out.println(df.format(cal.getTime()));
// subtract 4 hours from the time and print out the date and time
cal.add(Calendar.HOUR, -4);
System.out.println(df.format(cal.getTime()));
// add 12 hours to the current time and print out the date and time
cal.add(Calendar.AM_PM, 1);
System.out.println(df.format(cal.getTime()));
// add another 12 hours and print out the date and time
cal.add(Calendar.AM_PM, 1);
System.out.println(df.format(cal.getTime()));