public class DockerDateFormat
extends com.fasterxml.jackson.databind.util.StdDateFormat
Date only supports milliseconds. Creating a Date from the nanosecond timestamp
results in the date being set to several days after what date should be. This class converts the
timestamp from nanoseconds to milliseconds by removing the last six digits of the timestamp, so
we can generate a Date with the correct value (albeit with less precision).
Note: a more complete solution would be to introduce a custom date type which can store the
nanosecond value in an additional field, so users can access the complete value. Or just use Java
8 which has date objects with nanosecond support.DateFormat.Field_formatISO8601, _formatISO8601_z, _formatPlain, _formatRFC1123, _locale, _timezone, ALL_FORMATS, DATE_FORMAT_ISO8601, DATE_FORMAT_ISO8601_Z, DATE_FORMAT_PLAIN, DATE_FORMAT_RFC1123, DATE_FORMAT_STR_ISO8601, DATE_FORMAT_STR_ISO8601_Z, DATE_FORMAT_STR_PLAIN, DATE_FORMAT_STR_RFC1123, instanceAM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD| Constructor and Description |
|---|
DockerDateFormat() |
| Modifier and Type | Method and Description |
|---|---|
DockerDateFormat |
clone() |
Date |
parse(String source) |
format, getBlueprintISO8601Format, getBlueprintRFC1123Format, getDefaultTimeZone, getISO8601Format, getISO8601Format, getRFC1123Format, getRFC1123Format, getTimeZone, looksLikeISO8601, parse, parseAsISO8601, parseAsRFC1123, setTimeZone, toString, withLocale, withTimeZoneequals, format, format, getAvailableLocales, getCalendar, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getNumberFormat, getTimeInstance, getTimeInstance, getTimeInstance, hashCode, isLenient, parseObject, setCalendar, setLenient, setNumberFormatformat, formatToCharacterIterator, parseObjectpublic Date parse(String source) throws ParseException
parse in class com.fasterxml.jackson.databind.util.StdDateFormatParseExceptionpublic DockerDateFormat clone()
clone in class com.fasterxml.jackson.databind.util.StdDateFormatCopyright © 2016. All rights reserved.