public class NumberDateConverter extends AbstractDateConverter<java.lang.Number>
ObjectConverter implementation for <code>Number</code>. The number is normally a long value of the number of
milliseconds since January 1, 1970, 00:00:00 GMT as in Date.getTime()CONTEXT_DATE, CONTEXT_DATETIME, CONTEXT_TIME, PROPERTY_DATE_FORMAT| Constructor and Description |
|---|
NumberDateConverter()
Creates a DateConverter.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Number |
fromString(java.lang.String string,
ConverterContext context)
Converts from a String to a Number which is normally a long value of the number of milliseconds since January 1,
1970, 00:00:00 GMT as in
Date.getTime(). |
java.lang.String |
toString(java.lang.Number value,
ConverterContext context)
Converts the value to String.
|
anyDateToString, fromStringToDate, getDefaultDateFormat, getDefaultDateTimeFormat, getDefaultTimeFormat, setDefaultDateFormat, setDefaultDateTimeFormat, setDefaultTimeFormatfromString, getObjectConverterManager, toString, toStringConverterpublic java.lang.Number fromString(java.lang.String string,
ConverterContext context)
Date.getTime(). It will use the DateFormat defined as AbstractDateConverter.PROPERTY_DATE_FORMAT if any. Otherwise it will try different default DateFormat according to the context (Date,
Time or DateTime). At last it will try the following commonly used format patterns in order ("yyyy-mm-dd",
"yy-mm-dd", "yyyymmdd", "yymmdd", "dd-MMM-yy", "dd-MMM-yyyy") until it finds a match. We do that so that users
could type in other date formats and still could be recognized.fromString in interface ObjectConverter<java.lang.Number>fromString in class DefaultObjectConverter<java.lang.Number>string - the string to be converted.context - the context.public java.lang.String toString(java.lang.Number value,
ConverterContext context)
DefaultObjectConvertertoString in interface ObjectConverter<java.lang.Number>toString in class DefaultObjectConverter<java.lang.Number>value - the value to be concerted.context - converter context to be used