Reputation: 493
I'm using toLocaleString()
method to get this output "16 déc. 2012 23:00:28"
and then when I want to get the date back, I get Unparseable date error
.
String s = "16 déc. 2012 23:00:28";
SimpleDateFormat format = new SimpleDateFormat("dd MMM. yyyy HH:mm:ss");
Date d = format.parse(s);
Upvotes: 2
Views: 620
Reputation: 136112
This should work in your case
new SimpleDateFormat("dd MMM yyyy HH:mm:ss").parse(s);
your default locale is French, just remove '.'
Upvotes: 1
Reputation: 6322
Two things at play here:
Try this:
SimpleDateFormat format = new SimpleDateFormat("dd MMMM yyyy HH:mm:ss", Locale.FRENCH);
Upvotes: 5