public class Dates
extends Object
Date helpers used by the JSON parser for supported timestamp formats.
| Modifiers | Name | Description |
|---|---|---|
static int |
JSON_TIME_LENGTH |
Length of a JSON timestamp with millisecond precision. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static Date |
fromISO8601(char[] charArray, int from, int to) |
|
public static Date |
fromJsonDate(char[] charArray, int from, int to)Parses a supported JSON timestamp with millisecond precision. |
|
public static boolean |
isISO8601(char[] charArray, int start, int to)Checks whether a slice matches the parser's supported ISO-8601 layouts. |
|
public static boolean |
isISO8601QuickCheck(char[] charArray, int start, int to)Performs a quick length and separator check for ISO-8601-like values. |
|
public static boolean |
isJsonDate(char[] charArray, int start, int to)Checks whether a slice matches the parser's JSON date layout. |
|
public static OffsetDateTime |
offsetDateTimeFromISO8601(char[] charArray, int from, int to)Reads an ISO-8601 form as an offset date-time, keeping the offset the text carried. |
|
public static OffsetDateTime |
offsetDateTimeFromJsonDate(char[] charArray, int from, int to)Reads a JSON-date form as an offset date-time. |
|
public static Date |
toDate(TimeZone tz, int year, int month, int day, int hour, int minute, int second)Creates a Date from date-time fields in the supplied time zone. |
|
public static Date |
toDate(TimeZone tz, int year, int month, int day, int hour, int minute, int second, int milliseconds)Creates a Date from date-time fields including milliseconds. |
|
public static long |
utc(long time)Returns the epoch milliseconds for the supplied instant using a UTC-based calendar. |
Length of a JSON timestamp with millisecond precision.
Parses a supported JSON timestamp with millisecond precision.
charArray - source character bufferfrom - inclusive start indexto - exclusive end indexnull when the slice is not a supported JSON date valueChecks whether a slice matches the parser's supported ISO-8601 layouts.
charArray - source character bufferstart - inclusive start indexto - exclusive end indextrue when the slice matches a supported ISO-8601 layoutPerforms a quick length and separator check for ISO-8601-like values.
charArray - source character bufferstart - inclusive start indexto - exclusive end indextrue when the slice looks like an ISO-8601 valueChecks whether a slice matches the parser's JSON date layout.
charArray - source character bufferstart - inclusive start indexto - exclusive end indextrue when the slice matches the JSON date layoutReads an ISO-8601 form as an offset date-time, keeping the offset the text carried. Reads the same fields as fromISO8601(char[], int, int) rather than handing the text to a formatter, so that the scan stays as cheap as the one the parsers already do.
charArray - buffer holding the tokenfrom - start index, inclusiveto - end index, exclusivenull if the text is not in this formReads a JSON-date form as an offset date-time. That form carries no offset of its own and is read as UTC, as fromJsonDate(char[], int, int) reads it.
charArray - buffer holding the tokenfrom - start index, inclusiveto - end index, exclusivenull if the text is not in this formCreates a Date from date-time fields in the supplied time zone.
tz - time zone to applyyear - year valuemonth - month value from 1 to 12day - day of monthhour - hour of dayminute - minute of hoursecond - second of minuteCreates a Date from date-time fields including milliseconds.
tz - time zone to applyyear - year valuemonth - month value from 1 to 12day - day of monthhour - hour of dayminute - minute of hoursecond - second of minutemilliseconds - millisecond valueReturns the epoch milliseconds for the supplied instant using a UTC-based calendar.
time - epoch milliseconds