public class DateParser extends Object
Parses fixed-format strings containing date numbers, supporting the following formats Can handle padding at the end, dates are padded with 01 and times are padded with 00. * date8 - yyyyMMdd * datetime14 - yyyyMMddHHmmss * datetime17 - yyyyMMddHHmmssSSS * date8 - MMddyyyyy * datetime14 - MMddyyyyyHHmmss * datetime17 - MMddyyyyyHHmmssSSS * time6 - HHmmss * time9 - HHmmssSSS
DateNumber| Modifier and Type | Class and Description |
|---|---|
static class |
DateParser.QuietPos |
| Modifier and Type | Field and Description |
|---|---|
static TemporalQuery<LocalDate> |
QueryDate |
static TemporalQuery<LocalDateTime> |
QueryDateTime |
static TemporalQuery<LocalTime> |
QueryTime |
| Modifier | Constructor and Description |
|---|---|
protected |
DateParser() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull String |
digit(@Nullable CharSequence str,
int off,
pro.fessional.mirana.time.DateParser.Ptn ptn) |
static boolean |
isZidChar(char c) |
static @NotNull LocalDate |
parseDate(@NotNull CharSequence num)
parse any digit string with date information to a date
|
static @NotNull LocalDate |
parseDate(@NotNull CharSequence str,
DateTimeFormatter... dtf) |
static @NotNull LocalDate |
parseDate(@NotNull CharSequence str,
int off)
from the offset to parse any digit string with date format information.
|
static @NotNull LocalDate |
parseDate(@NotNull CharSequence str,
Iterable<DateTimeFormatter> dtf)
parse any digit string with date format information to a date
|
static @NotNull LocalDateTime |
parseDateTime(@NotNull CharSequence num)
parse any digit string with date information to a date
|
static @NotNull LocalDateTime |
parseDateTime(@NotNull CharSequence str,
DateTimeFormatter... dtf) |
static @NotNull LocalDateTime |
parseDateTime(@NotNull CharSequence str,
int off)
from the offset to parse any digit string with date format information.
|
static @NotNull LocalDateTime |
parseDateTime(@NotNull CharSequence str,
Iterable<DateTimeFormatter> dtf)
parse any digit string with date format information to a date
|
static @NotNull OffsetDateTime |
parseOffset(@NotNull CharSequence str,
ZoneId zid,
DateTimeFormatter... dtf) |
static @NotNull OffsetDateTime |
parseOffset(@NotNull CharSequence str,
ZoneId zid,
Iterable<DateTimeFormatter> dtf)
parse any digit string with date format information to a date at zoneId
|
static @NotNull OffsetDateTime |
parseOffset(@NotNull TemporalAccessor ta,
ZoneId zid)
parse any Temporal to a date at zoneId
|
static TemporalAccessor |
parseTemporal(@NotNull CharSequence str,
@NotNull Iterable<DateTimeFormatter> dtf,
boolean quiet)
Parse without exceptions, returns the best match (no exceptions, highest number of correct parses)
|
static @NotNull List<DateParser.QuietPos> |
parseTemporal(@NotNull Iterable<DateTimeFormatter> dtf,
@NotNull CharSequence str,
boolean stopOnSuccess)
Parse them all and returns the results in the order in which they were entered.
|
static @NotNull LocalTime |
parseTime(@NotNull CharSequence num)
parse any digit string with date information to a date
|
static @NotNull LocalTime |
parseTime(@NotNull CharSequence str,
DateTimeFormatter... dtf) |
static @NotNull LocalTime |
parseTime(@NotNull CharSequence str,
int off)
from the offset to parse any digit string with date format information.
|
static @NotNull LocalTime |
parseTime(@NotNull CharSequence str,
Iterable<DateTimeFormatter> dtf)
parse any digit string with date format information to a date
|
static @NotNull Date |
parseUtilDate(@NotNull CharSequence num)
parse any digit string with date information to a date
|
static @NotNull Date |
parseUtilDate(@NotNull CharSequence str,
int off)
from the offset to parse any digit string with date format information.
|
static @NotNull ZonedDateTime |
parseZoned(@NotNull CharSequence str)
parse any digit string with date information to a date
|
static @NotNull ZonedDateTime |
parseZoned(@NotNull CharSequence str,
ZoneId zid)
parse any digit string with date information to a date
|
static @NotNull ZonedDateTime |
parseZoned(@NotNull CharSequence str,
ZoneId zid,
DateTimeFormatter... dtf) |
static @NotNull ZonedDateTime |
parseZoned(@NotNull CharSequence str,
ZoneId zid,
int off)
from the offset to parse any digit string with date format information.
|
static @NotNull ZonedDateTime |
parseZoned(@NotNull CharSequence str,
ZoneId zid,
Iterable<DateTimeFormatter> dtf)
parse any digit string with date format information to a date at zoneId
|
static @NotNull ZonedDateTime |
parseZoned(@NotNull TemporalAccessor ta,
ZoneId zid)
parse any Temporal at zoneId
|
public static final TemporalQuery<LocalTime> QueryTime
public static final TemporalQuery<LocalDate> QueryDate
public static final TemporalQuery<LocalDateTime> QueryDateTime
@NotNull public static @NotNull LocalTime parseTime(@NotNull @NotNull CharSequence num)
@NotNull public static @NotNull LocalDate parseDate(@NotNull @NotNull CharSequence num)
@NotNull public static @NotNull Date parseUtilDate(@NotNull @NotNull CharSequence num)
@NotNull public static @NotNull LocalDateTime parseDateTime(@NotNull @NotNull CharSequence num)
@NotNull public static @NotNull ZonedDateTime parseZoned(@NotNull @NotNull CharSequence str)
@NotNull public static @NotNull ZonedDateTime parseZoned(@NotNull @NotNull CharSequence str, ZoneId zid)
@NotNull public static @NotNull LocalTime parseTime(@NotNull @NotNull CharSequence str, Iterable<DateTimeFormatter> dtf)
@NotNull public static @NotNull LocalDate parseDate(@NotNull @NotNull CharSequence str, Iterable<DateTimeFormatter> dtf)
@NotNull public static @NotNull LocalDateTime parseDateTime(@NotNull @NotNull CharSequence str, Iterable<DateTimeFormatter> dtf)
@NotNull public static @NotNull ZonedDateTime parseZoned(@NotNull @NotNull TemporalAccessor ta, ZoneId zid)
@NotNull public static @NotNull ZonedDateTime parseZoned(@NotNull @NotNull CharSequence str, ZoneId zid, Iterable<DateTimeFormatter> dtf)
@NotNull public static @NotNull OffsetDateTime parseOffset(@NotNull @NotNull TemporalAccessor ta, ZoneId zid)
@NotNull public static @NotNull OffsetDateTime parseOffset(@NotNull @NotNull CharSequence str, ZoneId zid, Iterable<DateTimeFormatter> dtf)
@NotNull public static @NotNull LocalTime parseTime(@NotNull @NotNull CharSequence str, DateTimeFormatter... dtf)
@NotNull public static @NotNull LocalDate parseDate(@NotNull @NotNull CharSequence str, DateTimeFormatter... dtf)
@NotNull public static @NotNull LocalDateTime parseDateTime(@NotNull @NotNull CharSequence str, DateTimeFormatter... dtf)
@NotNull public static @NotNull ZonedDateTime parseZoned(@NotNull @NotNull CharSequence str, ZoneId zid, DateTimeFormatter... dtf)
@NotNull public static @NotNull OffsetDateTime parseOffset(@NotNull @NotNull CharSequence str, ZoneId zid, DateTimeFormatter... dtf)
@NotNull public static @NotNull LocalTime parseTime(@NotNull @NotNull CharSequence str, int off)
from the offset to parse any digit string with date format information. focusing only on numbers when parsing, ignoring non-numeric characters. * time6 - HHmmss * time9 - HHmmssSSS
@NotNull public static @NotNull LocalDate parseDate(@NotNull @NotNull CharSequence str, int off)
from the offset to parse any digit string with date format information. focusing only on numbers when parsing, ignoring non-numeric characters. * date8 - yyyyMMdd * date8 - MMddyyyy
@NotNull public static @NotNull Date parseUtilDate(@NotNull @NotNull CharSequence str, int off)
from the offset to parse any digit string with date format information. focusing only on numbers when parsing, ignoring non-numeric characters.
@NotNull public static @NotNull LocalDateTime parseDateTime(@NotNull @NotNull CharSequence str, int off)
from the offset to parse any digit string with date format information. focusing only on numbers when parsing, ignoring non-numeric characters. * datetime14 - yyyyMMddHHmmss * datetime17 - yyyyMMddHHmmssSSS * datetime14 - MMddyyyyHHmmss * datetime17 - MMddyyyyHHmmssSSS
@NotNull public static @NotNull ZonedDateTime parseZoned(@NotNull @NotNull CharSequence str, ZoneId zid, int off)
from the offset to parse any digit string with date format information. focusing only on numbers when parsing, ignoring non-numeric characters. * datetime14 - yyyyMMddHHmmss * datetime17 - yyyyMMddHHmmssSSS * datetime14 - MMddyyyyHHmmss * datetime17 - MMddyyyyHHmmssSSS The timezone part comes after the time separated by `+- [ `, only offset and zid formats are supported, and zid takes precedence over offset. V time-zone ID zone-id America/Los_Angeles; Z; -08:30 O localized zone-offset offset-O GMT+8; GMT+08:00; UTC-08:00; X zone-offset 'Z' for zero offset-X Z; -08; -0830; -08:30; -083015; -08:30:15; x zone-offset offset-x +0000; -08; -0830; -08:30; -083015; -08:30:15; Z zone-offset offset-Z +0000; -0800; -08:00; ISO_ZONED_DATE_TIME +01:00[Europe/Paris]
@Contract(value="_,_,false->!null") public static TemporalAccessor parseTemporal(@NotNull @NotNull CharSequence str, @NotNull @NotNull Iterable<DateTimeFormatter> dtf, boolean quiet)
str - Any string containing full or half-width digits.dtf - The formatter to try.quiet - return null instead of an exception.@NotNull public static @NotNull List<DateParser.QuietPos> parseTemporal(@NotNull @NotNull Iterable<DateTimeFormatter> dtf, @NotNull @NotNull CharSequence str, boolean stopOnSuccess)
dtf - formatstr - StringstopOnSuccess - Whether to stop subsequent matches when there are completed matchers, performance related@NotNull public static @NotNull String digit(@Nullable @Nullable CharSequence str, int off, pro.fessional.mirana.time.DateParser.Ptn ptn)
public static boolean isZidChar(char c)
Copyright © 2023. All rights reserved.