I run the following code and obtain incorrect date (instead of 1/2/2015 6:00:00 AM it prints 12/28/2015 6:00:00 AM):
SimpleDateFormat _sdf = new SimpleDateFormat("M/d/YYYY H:mm:ss a");
_time = "02/01/2015 6:00:00 AM";
Date date;
try {
date = _sdf.parse(_time);
Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(date);
_time = _sdf.format(calendar.getTime());
System.out.println(_time); // 12/28/2015 6:00:00 AM !!!
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}