I've got this string
23/Gennaio/2014
and I need this other string
23/01/2014
I tried using joda.time:
DateTimeFormatter format = DateTimeFormat.forPattern("dd/MMM/yyyy").withLocale(Locale.ITALY);
DateTime instance = format.parseDateTime("23/Gennaio/2014");
String month_number = String.valueOf(instance.getMonthOfYear());
But I get this exception:
01-06 13:31:55.341: E/AndroidRuntime(1116): java.lang.IllegalArgumentException: Invalid format: "23/Gennaio/2014"
What am I missing?
It seems to expect the month name in lower case (not sure why):
DateTime instance = format.parseDateTime("23/Gennaio/2014".toLowerCase(Locale.ITALIAN));
should work better.