public interface DateFormatter
Modifier and Type | Method and Description |
---|---|
String |
format(TemporalAccessor accessor)
Print the supplied java time accessor in a string based representation according to this formatter
|
default String |
formatJoda(org.joda.time.ReadableInstant dateTime)
Return the given Joda
DateTime formatted with this format. |
default String |
formatMillis(long millis)
Return the given millis-since-epoch formatted with this format.
|
Locale |
locale()
Returns the configured locale of the date formatter
|
TemporalAccessor |
parse(String input)
Try to parse input to a java time TemporalAccessor
|
default org.joda.time.DateTime |
parseJoda(String input)
Parse the given input into a Joda
DateTime . |
String |
pattern()
A name based format for this formatter.
|
static List<String> |
splitCombinedPatterns(String input) |
JodaDateMathParser |
toDateMathParser()
Return a
DateMathParser built from this formatter. |
DateFormatter |
withLocale(Locale locale)
Create a copy of this formatter that is configured to parse dates in the specified locale
|
DateFormatter |
withZone(ZoneId zoneId)
Create a copy of this formatter that is configured to parse dates in the specified time zone
|
ZoneId |
zone()
Returns the configured time zone of the date formatter
|
TemporalAccessor parse(String input)
input
- An arbitrary string resembling the string representation of a date or timeIllegalArgumentException
- If parsing fails, this exception will be thrown.
Note that it can contained suppressed exceptions when several
formatters failed parse this valueDateTimeException
- if the parsing result exceeds the supported range of ZoneDateTime
or if the parsed instant exceeds the maximum or minimum instantdefault org.joda.time.DateTime parseJoda(String input)
DateTime
.DateFormatter withZone(ZoneId zoneId)
zoneId
- The time zone to act onDateFormatter withLocale(Locale locale)
locale
- The local to use for the new formatterString format(TemporalAccessor accessor)
accessor
- The temporal accessor used to formatdefault String formatMillis(long millis)
default String formatJoda(org.joda.time.ReadableInstant dateTime)
DateTime
formatted with this format.String pattern()
epoch_millis
or
a configured format like HH:mm:ss
Locale locale()
ZoneId zone()
JodaDateMathParser toDateMathParser()
DateMathParser
built from this formatter.Copyright © 2022. All rights reserved.