Oracle
docs.oracle.com › javase › 8 › docs › api › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java Platform SE 8 )
October 20, 2025 - java.time.format.DateTimeFormatterBuilder · public final class DateTimeFormatterBuilder extends Object · Builder to create date-time formatters. This allows a DateTimeFormatter to be created. All date-time formatters are created ultimately using this builder.
Videos
10:28
129 - Utility Classes - DateTimeFormatter - YouTube
01:32
Easy Date & Time Formatting with DateTimeFormatterBuilder #java ...
Easy Date & Time Formatting with DateTimeFormatterBuilder ...
DateTimeFormatter in Java
09:54
Format Dates And Times in Java Using DateTimeFormatter - YouTube
Oracle
docs.oracle.com › javase › 8 › docs › api › java › time › format › DateTimeFormatter.html
DateTimeFormatter (Java Platform SE 8 )
October 20, 2025 - Java™ Platform Standard Ed. 8 ... Formatter for printing and parsing date-time objects. This class provides the main application entry point for printing and parsing and provides common implementations of DateTimeFormatter: Using predefined constants, such as ISO_LOCAL_DATE ...
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › format › DateTimeFormatter.html
DateTimeFormatter (Java SE 17 & JDK 17)
January 20, 2026 - Pad modifier: Modifies the pattern that immediately follows to be padded with spaces. The pad width is determined by the number of pattern letters. This is the same as calling DateTimeFormatterBuilder.padNext(int).
Oracle
docs.oracle.com › en › java › javase › 22 › docs › api › java.base › java › time › format › DateTimeFormatter.html
DateTimeFormatter (Java SE 22 & JDK 22)
July 16, 2024 - Pad modifier: Modifies the pattern that immediately follows to be padded with spaces. The pad width is determined by the number of pattern letters. This is the same as calling DateTimeFormatterBuilder.padNext(int).
Oracle
docs.oracle.com › en › java › javase › 24 › docs › api › java.base › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java SE 24 & JDK 24)
April 15, 2025 - declaration: module: java.base, package: java.time.format, class: DateTimeFormatterBuilder
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java SE 11 & JDK 11 )
July 15, 2025 - java.time.format.DateTimeFormatterBuilder · public final class DateTimeFormatterBuilder extends Object · Builder to create date-time formatters. This allows a DateTimeFormatter to be created. All date-time formatters are created ultimately using this builder.
ConcretePage
concretepage.com › java › java-8 › java-datetimeformatter
Java DateTimeFormatter
We can use the above methods while instantiating DateTimeFormatter using DateTimeFormatterBuilder. Find the sample code. package com.concretepage; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.chrono.IsoChronology; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.format.DecimalStyle; import java.time.format.ResolverStyle; import java.time.format.TextStyle; import java.time.temporal.ChronoField; import java.util.Locale; public class DateTimeFormatterDemo { public static void main(String[] args) { DateTimeFo
Oracle
docs.oracle.com › en › java › javase › 11 › docs › api › java.base › java › time › format › DateTimeFormatter.html
DateTimeFormatter (Java SE 11 & JDK 11 )
January 20, 2026 - Leap seconds occur at '23:59:60' in the UTC time-zone, but at other local times in different time-zones. To avoid this potential ambiguity, the handling of leap-seconds is limited to DateTimeFormatterBuilder.appendInstant(), as that method always parses the instant with the UTC zone offset.
Oracle
docs.oracle.com › javase › 8 › docs › api › java › time › format › class-use › DateTimeFormatterBuilder.html
Uses of Class java.time.format.DateTimeFormatterBuilder (Java Platform SE 8 )
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java SE 21 & JDK 21)
January 20, 2026 - declaration: module: java.base, package: java.time.format, class: DateTimeFormatterBuilder
Joda
joda.org › joda-time › apidocs › org › joda › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Joda-Time 2.14.0 API)
java.lang.Object · org.joda.time.format.DateTimeFormatterBuilder · public class DateTimeFormatterBuilder extends Object · Factory that creates complex instances of DateTimeFormatter via method calls. Datetime formatting is performed by the DateTimeFormatter class.
Oracle
docs.oracle.com › en › java › javase › 17 › docs › api › java.base › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java SE 17 & JDK 17)
January 20, 2026 - declaration: module: java.base, package: java.time.format, class: DateTimeFormatterBuilder
Top answer 1 of 2
16
It may be the reason that +0000 is not a zone id, but a zone offset.
the documentation offers this list:
Symbol Meaning Presentation Examples
------ ------- ------------ -------
V time-zone ID zone-id America/Los_Angeles; Z; -08:30
z time-zone name zone-name Pacific Standard Time; PST
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;
You may use appendOffset("+HHMM", "0000") (doc) or appendZoneOrOffsetId() (doc) instead of appendZoneId().
so your full formatter may look like the following
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.append(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
.optionalStart()
.appendPattern(".SSS")
.optionalEnd()
.optionalStart()
.appendZoneOrOffsetId()
.optionalEnd()
.optionalStart()
.appendOffset("+HHMM", "0000")
.optionalEnd()
.toFormatter();
Further the way of creating a ZonedDateTime may influence if there is an exception or not. Therefore I'd recommend the following as this worked without any exceptions.
LocalDateTime time = LocalDateTime.parse("2013-09-20T07:00:33.123+0000", formatter);
ZonedDateTime zonedTime = time.atZone(ZoneId.systemDefault());
2 of 2
0
Did you try .appendPattern("ZZZ")? it would probably work!
Oracle
docs.oracle.com › en › java › javase › 16 › docs › api › java.base › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java SE 16 & JDK 16)
January 6, 2022 - public DateTimeFormatterBuilder appendValueReduced(TemporalField field, int width, int maxWidth, ChronoLocalDate baseDate)
Oracle
docs.oracle.com › en › java › javase › 21 › docs › api › java.base › java › time › format › DateTimeFormatter.html
DateTimeFormatter (Java SE 21 & JDK 21)
January 20, 2026 - Pad modifier: Modifies the pattern that immediately follows to be padded with spaces. The pad width is determined by the number of pattern letters. This is the same as calling DateTimeFormatterBuilder.padNext(int).
Oracle
docs.oracle.com › en › java › javase › 23 › docs › api › java.base › java › time › format › DateTimeFormatterBuilder.html
DateTimeFormatterBuilder (Java SE 23 & JDK 23)
October 17, 2024 - declaration: module: java.base, package: java.time.format, class: DateTimeFormatterBuilder