public class DateTimeParser extends Object
time
parameter of the request. The date, time and period are expected to be
formatted according ISO-8601 standard.Modifier and Type | Class and Description |
---|---|
static class |
DateTimeParser.FormatAndPrecision |
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_GET_TIME_ON_CURRENT
FLAG to return current time when the String to be parsed is "current"
|
static int |
FLAG_GET_TIME_ON_NOW
FLAG to return current time when the String to be parsed is "now"
|
static int |
FLAG_GET_TIME_ON_PRESENT
FLAG to return current time when the String to be parsed is "present"
|
static int |
FLAG_IS_LENIENT
FLAG allowing Lenient ISO8601 format alternatives, for example, YYYYMMdd in addition to
YYYY-MM-dd).
|
static int |
FLAG_SINGLE_DATE_AS_DATERANGE
FLAG to return a validity date range for dates with reduced precision
|
static String[] |
LENIENT_FORMATS_DAY |
static String[] |
LENIENT_FORMATS_HOUR |
static String[] |
LENIENT_FORMATS_MILLISECOND |
static String[] |
LENIENT_FORMATS_MINUTE |
static String[] |
LENIENT_FORMATS_MONTH |
static String[] |
LENIENT_FORMATS_SECOND |
static String[] |
LENIENT_FORMATS_YEAR |
static long |
MILLIS_IN_DAY
Amount of milliseconds in a day.
|
static TimeZone |
UTC_TZ
UTC timezone to serve as reference
|
Constructor and Description |
---|
DateTimeParser()
Builds a default TimeParser with no provided maximum number of times
|
DateTimeParser(int maxTimes)
Parses times throwing an exception if the final list exceeds maxTimes
|
DateTimeParser(int maxTimes,
int flags)
Parses times throwing an exception if the final list exceeds maxTimes
|
Modifier and Type | Method and Description |
---|---|
void |
checkMaxTimes(Set result,
int maxValues) |
Collection |
parse(String value)
Parses the date given in parameter.
|
static long |
parsePeriod(String period)
Parses the increment part of a period and returns it in milliseconds.
|
public static final int FLAG_GET_TIME_ON_PRESENT
public static final int FLAG_GET_TIME_ON_NOW
public static final int FLAG_GET_TIME_ON_CURRENT
public static final int FLAG_IS_LENIENT
public static final int FLAG_SINGLE_DATE_AS_DATERANGE
public static final String[] LENIENT_FORMATS_MILLISECOND
public static final String[] LENIENT_FORMATS_SECOND
public static final String[] LENIENT_FORMATS_MINUTE
public static final String[] LENIENT_FORMATS_HOUR
public static final String[] LENIENT_FORMATS_DAY
public static final String[] LENIENT_FORMATS_MONTH
public static final String[] LENIENT_FORMATS_YEAR
public static final TimeZone UTC_TZ
public static final long MILLIS_IN_DAY
public DateTimeParser()
public DateTimeParser(int maxTimes)
maxTimes
- Maximum number of times to parse, or a non positive number to have no limitpublic DateTimeParser(int maxTimes, int flags)
maxTimes
- Maximum number of times to parse, or a non positive number to have no limitflags
- a combination (bitwise OR) of FLAG_XXX to customize the parsing.public Collection parse(String value) throws ParseException
value
string.value
- The date, time and period to parse.value
string is null or empty.ParseException
- if the string can not be parsed.public void checkMaxTimes(Set result, int maxValues)
public static long parsePeriod(String period) throws ParseException
period
- A string representation of the time increment according the ISO-8601:1988(E)
standard. For example: "P1D"
= one day.ParseException
- if the string can not be parsed.Copyright © 1996–2021 Geotools. All rights reserved.