Reputation: 8585
I have string "1/28/2013 3:26:51 PM"
SimpleDateFormat formatter = new SimpleDateFormat("M/dd/yyyy h:mm:ss a");
try {
this.createDate = formatter.parse(xmlPhoto.getCreateDate());
this.shootDate = formatter.parse(xmlPhoto.getShootDate());
} catch (ParseException e) {
e.printStackTrace();
}
I want to make a Date object from this String, but I get a ParseExceprion
and offset = 19.
Upvotes: 0
Views: 85
Reputation: 159774
The AM/PM
marker may not be be matching with that from your default Locale
. try with:
new SimpleDateFormat("M/dd/yyyy h:mm:ss a", Locale.ENGLISH)
Upvotes: 4