public final class RubyDateTimeFormatter extends Object
Methods in this class are designed to be similar to DateTimeFormatter
.
Parsing is implemented as a two-phase operation like DateTimeFormatter
does.
Modifier and Type | Method and Description |
---|---|
static RubyDateTimeFormatter |
ofPattern(String pattern)
Creates a formatter using the specified pattern with the default resolver similar to Ruby's
Time.strptime . |
TemporalAccessor |
parse(String text)
Parses the text using this formatter and the registered resolver.
|
TemporalAccessor |
parseUnresolved(String text)
Parses the text using this formatter, without resolving the result, intended for advanced use cases.
|
RubyDateTimeFormatter |
withResolver(RubyDateTimeResolver resolver)
Returns a copy of this formatter with a new resolver.
|
public static RubyDateTimeFormatter ofPattern(String pattern)
Time.strptime
.pattern
- the pattern to use, not nullpublic TemporalAccessor parseUnresolved(String text)
text
- the text to parse, not nullRubyDateTimeParseException
- if the parse results in an errorpublic TemporalAccessor parse(String text)
text
- the text to parse, not nullRubyDateTimeParseException
- if unable to parse the requested resultpublic RubyDateTimeFormatter withResolver(RubyDateTimeResolver resolver)
resolver
- the new resolver, not null