public class DateConverter extends Object implements ValueConverter<Date>
Dates using a DateFormat object.| Constructor and Description |
|---|
DateConverter(DateFormat formatter)
Creates a converter that uses the given date formatter/parser.
|
| Modifier and Type | Method and Description |
|---|---|
Date |
convert(String value)
Converts the given string value into a Java type.
|
static DateConverter |
datePattern(String pattern)
Creates a converter that uses a
SimpleDateFormat with the given date/time pattern. |
String |
valuePattern()
Gives a string that describes the pattern of the values this converter expects, if any.
|
Class<Date> |
valueType()
Gives the class of the type of values this converter converts to.
|
public DateConverter(DateFormat formatter)
formatter - the formatter/parser to useNullPointerException - if formatter is nullpublic static DateConverter datePattern(String pattern)
SimpleDateFormat with the given date/time pattern. The date formatter
created is not lenient.pattern - expected date/time patternNullPointerException - if pattern is nullIllegalArgumentException - if pattern is invalidpublic Date convert(String value)
ValueConverterconvert in interface ValueConverter<Date>value - the string to convertpublic Class<Date> valueType()
ValueConvertervalueType in interface ValueConverter<Date>public String valuePattern()
ValueConverterdate format string.valuePattern in interface ValueConverter<Date>null if there's nothing interesting hereCopyright © 2017. All Rights Reserved.