public static class Formats.DateFormatter extends Formatters.SimpleFormatter<Date>
java.util.Date values.| Constructor and Description |
|---|
DateFormatter(MessagesApi messagesApi)
Creates a date formatter.
|
DateFormatter(MessagesApi messagesApi,
String pattern)
Creates a date formatter.
|
DateFormatter(MessagesApi messagesApi,
String pattern,
String patternNoApp)
Creates a date formatter.
|
| Modifier and Type | Method and Description |
|---|---|
Date |
parse(String text,
Locale locale)
Binds the field - constructs a concrete value from submitted data.
|
String |
print(Date value,
Locale locale)
Unbinds this fields - converts a concrete value to a plain string.
|
public DateFormatter(MessagesApi messagesApi)
messagesApi - messages to look up the patternpublic DateFormatter(MessagesApi messagesApi, String pattern)
messagesApi - messages to look up the patternpattern - date pattern, as specified for SimpleDateFormat. Can be a message file
key.public DateFormatter(MessagesApi messagesApi, String pattern, String patternNoApp)
messagesApi - messages to look up the patternpattern - date pattern, as specified for SimpleDateFormat. Can be a message file
key.patternNoApp - date pattern to use as fallback when no app is started.public Date parse(String text, Locale locale) throws ParseException
parse in class Formatters.SimpleFormatter<Date>text - the field textlocale - the current LocaleParseException - if the text could not be parsed into T