Package play.data.format
Class Formats.DateFormatter
- Enclosing class:
- Formats
Formatter for
java.util.Date values.-
Constructor Summary
ConstructorsConstructorDescriptionDateFormatter(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. -
Method Summary
-
Constructor Details
-
DateFormatter
Creates a date formatter. The value defined for the message file key "formats.date" will be used as the default pattern.- Parameters:
messagesApi- messages to look up the pattern
-
DateFormatter
Creates a date formatter.- Parameters:
messagesApi- messages to look up the patternpattern- date pattern, as specified forSimpleDateFormat. Can be a message file key.
-
DateFormatter
Creates a date formatter.- Parameters:
messagesApi- messages to look up the patternpattern- date pattern, as specified forSimpleDateFormat. Can be a message file key.patternNoApp- date pattern to use as fallback when no app is started.
-
-
Method Details
-
parse
Binds the field - constructs a concrete value from submitted data.- Specified by:
parsein classFormatters.SimpleFormatter<Date>- Parameters:
text- the field textlocale- the currentLocale- Returns:
- a new value
- Throws:
ParseException- if the text could not be parsed into T
-
print
Unbinds this fields - converts a concrete value to a plain string.- Specified by:
printin classFormatters.SimpleFormatter<Date>- Parameters:
value- the value to unbindlocale- the currentLocale- Returns:
- printable version of the value
-