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

347
Views
¿Cómo convertir la marca de tiempo de PostgreSQL con zona horaria a Java Instant o OffSetDateTime?

¿Cómo convertir la marca de tiempo de PostgreSQL con zona horaria a Java Instant o OffSetDateTime?

Marca de tiempo de PostgreSQL con formato de zona horaria: 2020-06-18 16:15:38+05:30

Obtener la siguiente excepción en Java 11.7 - Ubuntu para Instant.parse("2020-06-18 16:15:38+05:30".replace(" ", "T"))

 Exception in thread "main" java.time.format.DateTimeParseException: Text '2020-06-18T16:15:38+05:30' could not be parsed at index 19 at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046) at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948) at java.base/java.time.Instant.parse(Instant.java:395) at OffSetDateTimeExample.main(OffSetDateTimeExample.java:9)

pero funciona en Java 13.

Cualquier ayuda para que funcione en Java 11

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Dividir el valor del tipo de rango

tstzrange es un tipo de rango en Postgres.

Divida el tstzrange de PostgreSQL en la consulta llamando a las funciones lower y upper .

 select *, lower(tstzrange) as lower_tstzrange, upper(tstzrange) as upper_tstzrange from announcement ;

y utilícelo en Resultset como OffsetDateTime

 TstzRange.builder() .startDateTime(rs.getObject("lower_tstzrange", OffsetDateTime.class)) .endDateTime(rs.getObject("upper_tstzrange", OffsetDateTime.class)) .build()

Gracias a a_horse_with_no_name y Arvind Kumar Avinash por salvarme el día y aprender a dividir tipos de datos de rango.

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!