One possibility is that your default Locale
has different symbols for AM/PM. When constructing a date format you should always supply a Locale
unless you really want to use the system’s default Locale
, e.g.:
SimpleDateFormat sdf = new SimpleDateFormat("M/d/yy h:mm:ss a", Locale.US)