public class JodaDateFormatter extends Object implements DateFormatter
| Modifier and Type | Field and Description |
|---|---|
org.joda.time.format.DateTimeFormatter |
parser |
org.joda.time.format.DateTimeFormatter |
printer |
| Constructor and Description |
|---|
JodaDateFormatter(String pattern,
org.joda.time.format.DateTimeFormatter parser,
org.joda.time.format.DateTimeFormatter printer) |
| 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
|
String |
formatJoda(org.joda.time.DateTime dateTime) |
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 using joda-time library.
|
org.joda.time.DateTime |
parseJoda(String input)
Parse the given input into a Joda
DateTime. |
long |
parseMillis(String input) |
String |
pattern()
A name based format for this formatter.
|
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
|
JodaDateFormatter |
withYear(int year) |
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
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitformatJoda, splitCombinedPatternspublic final org.joda.time.format.DateTimeFormatter parser
public final org.joda.time.format.DateTimeFormatter printer
public JodaDateFormatter(String pattern, org.joda.time.format.DateTimeFormatter parser, org.joda.time.format.DateTimeFormatter printer)
public TemporalAccessor parse(String input)
parse in interface DateFormatterinput - An arbitrary string resembling the string representation of a date or timeIllegalArgumentException - if the text to parse is invalidDateTimeException - if the parsing result exceeds the supported range
of ZoneDateTime or if the parsed instant exceeds
the maximum or minimum instantDateFormatter.parse(String)public long parseMillis(String input)
public org.joda.time.DateTime parseJoda(String input)
DateFormatterDateTime.parseJoda in interface DateFormatterpublic DateFormatter withZone(ZoneId zoneId)
DateFormatterwithZone in interface DateFormatterzoneId - The time zone to act onpublic DateFormatter withLocale(Locale locale)
DateFormatterwithLocale in interface DateFormatterlocale - The local to use for the new formatterpublic String format(TemporalAccessor accessor)
DateFormatterformat in interface DateFormatteraccessor - The temporal accessor used to formatpublic String formatJoda(org.joda.time.DateTime dateTime)
public String formatMillis(long millis)
DateFormatterformatMillis in interface DateFormatterpublic JodaDateFormatter withYear(int year)
public String pattern()
DateFormatterepoch_millis or
a configured format like HH:mm:sspattern in interface DateFormatterpublic Locale locale()
DateFormatterlocale in interface DateFormatterpublic ZoneId zone()
DateFormatterzone in interface DateFormatterpublic JodaDateMathParser toDateMathParser()
DateFormatterDateMathParser built from this formatter.toDateMathParser in interface DateFormatterCopyright © 2022. All rights reserved.