Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

2.4K
Vistas
Java LocalDateTime: Why is Unsupported field: OffsetSeconds produced?

I'm trying to parse the below processingdate so that I can eventually end up with a date of format 2020-11-10T10:43:07+00:00. How can I amend the below to produce this?

 String processingDate = "2020-11-24";
    LocalDateTime dt =
        LocalDateTime.of(
            LocalDate.parse(
                processingDate, DateTimeFormatter.ISO_DATE),
            LocalTime.now());

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ssXXX");
OffsetDateTime dateTime = OffsetDateTime.parse(dt.format(formatter));
System.out.println(dateTime);

java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: OffsetSeconds
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

A local datetime doesn't contain any concept of zones or offsets. You are trying to print the offset to a string by using XXX at the end of the pattern.

But anyway, there is no need to go from a LocalDateTime -> String -> OffsetDateTime.

Just do

dt.atOffset(ZoneOffset.UTC)

or whatever other offset you want

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda