You're going to have create your own mapping.
Here's what already exists: Joda Time has a method DateTimeFormat.patternForStyle
, which delegates to the patterns specified by the JDK in java.text.DateFormat
. See Using Predefined Formats, which provides the following table:
Style U.S. Locale French Locale
DEFAULT Jun 30, 2009 30 juin 2009
SHORT 6/30/09 30/06/09
MEDIUM Jun 30, 2009 30 juin 2009
LONG June 30, 2009 30 juin 2009
FULL Tuesday, June 30, 2009 mardi 30 juin 2009
You specify which Locale
specific format you in patternForStyle
by using S
, M
, L
, F
, and -
to leave it blank. So, in your case, it sounds like you want date only, so use:
DateTimeFormat.patternForStyle("S-", locale);
Unfortunately, this option will result in a TWO digit year.
So, either do all of that, or **create your own map` of DateTimeFormatters for this purpose. Something like:
public class DateFormatterProvider {
private final Map<Locale, DateTimeFormatter> formatterMap = new HashMap<>();
public DateFormatterProvider() {
formatterMap.put(Locale.US, DateTimeFormat.forPattern("dd/MM/yyyy"));
formatterMap.put(Locale.FRENCH, DateTimeFormat.forPattern("MM/dd/yyyy"));
// etc.
}
}