Forum Stats

  • 3,837,399 Users
  • 2,262,255 Discussions
  • 7,900,269 Comments

Discussions

ChronoField.CLOCK_HOUR_OF_DAY returns 24

user12954049
user12954049 Member Posts: 1
edited Aug 21, 2019 2:25PM in Java Programming

I am working on java 8 and  decided to try the new API ChronoField in Java 8 . However, it has the following issue.

Whenever the time is 12 am, ChronoField.CLOCK_HOUR_OF_DAY returns 24.

I was trying to put this date/time in Postgresql database which  threw the exception-

Cause: org.postgresql.util.PSQLException: ERROR: date/time field value out of range: "2019-7-9 24:30:24.983950"

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

I thought it would print "00" as described in the API but that conversion(24 to 00) does not occur.

Answers