Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.4K
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!