public static class Formats.DateFormatter extends Formatters.SimpleFormatter<java.util.Date>
java.util.Date
values.Constructor and Description |
---|
DateFormatter(MessagesApi messagesApi)
Creates a date formatter.
|
DateFormatter(MessagesApi messagesApi,
java.lang.String pattern)
Creates a date formatter.
|
DateFormatter(MessagesApi messagesApi,
java.lang.String pattern,
java.lang.String patternNoApp)
Creates a date formatter.
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
parse(java.lang.String text,
java.util.Locale locale)
Binds the field - constructs a concrete value from submitted data.
|
java.lang.String |
print(java.util.Date value,
java.util.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, java.lang.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, java.lang.String pattern, java.lang.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 java.util.Date parse(java.lang.String text, java.util.Locale locale) throws java.text.ParseException
parse
in class Formatters.SimpleFormatter<java.util.Date>
text
- the field textlocale
- the current Locale
java.text.ParseException
- if the text could not be parsed into Tpublic java.lang.String print(java.util.Date value, java.util.Locale locale)
print
in class Formatters.SimpleFormatter<java.util.Date>
value
- the value to unbindlocale
- the current Locale