DateTimeFormatterBuilder.appendInstant

Appends an instant using ISO-8601 to the formatter, formatting fractional digits _in groups of three. !(p) Instants have a fixed output format. They are converted to a date-time with a zone-offset of UTC and formatted using the standard ISO-8601 format. With this method, formatting nano-of-second outputs zero, three, six or nine digits as necessary. The localized decimal style is not used. !(p) The instant is obtained using {@link ChronoField#INSTANT_SECONDS INSTANT_SECONDS} and optionally {@code NANO_OF_SECOND}. The value of {@code INSTANT_SECONDS} may be outside the maximum range of {@code LocalDateTime}. !(p) The {@linkplain ResolverStyle resolver style} has no effect on instant parsing. The end-of-day time of '24:00' is handled as midnight at the start of the following day. The leap-second time of '23:59:59' is handled to some degree, see {@link DateTimeFormatter#parsedLeapSecond()} for full details. !(p) When formatting, the instant will always be suffixed by 'Z' to indicate UTC. When parsing, the behaviour of {@link DateTimeFormatterBuilder#appendOffsetId()} will be used to parse the offset, converting the instant to UTC as necessary. !(p) An alternative to this method is to format/parse the instant as a single epoch-seconds value. That is achieved using {@code appendValue(INSTANT_SECONDS)}.

@return this, for chaining, not null

  1. DateTimeFormatterBuilder appendInstant()
    class DateTimeFormatterBuilder
  2. DateTimeFormatterBuilder appendInstant(int fractionalDigits)

Meta