Menu

#35 24:00 should parse as 00:00 next day

open
nobody
None
4
2012-10-08
2008-04-03
Anonymous
No

According to ISO 8601, hour 24 (which always has 0 minutes, seconds and millis) is the same instant as 00:00 the next day.

With this info, it seems that the DateTimeFormat pattern 'hh' should allow hours 0-24 and not only 0-23. So, for example "2008-04-03 24:00" should be parsed into the same instant as "2008-04-04 00:00".

The 24:00 style is used widely to indicate the end of a day (as opposed to 00:00 being the start), so this is a real problem.

From http://www.cl.cam.ac.uk/~mgk25/iso-time.html:

"The international standard notation for the time of day is

hh:mm:ss

where hh is the number of complete hours that have passed since midnight (00-24), mm is the number of complete minutes that have passed since the start of the hour (00-59), and ss is the number of complete seconds since the start of the minute (00-60). If the hour value is 24, then the minute and second values must be zero."

Discussion

  • Simen Rokaas

    Simen Rokaas - 2008-04-03

    Logged In: YES
    user_id=1199193
    Originator: NO

    I submitted this as a bug and not a feature because I believe it is a bug that Joda time violates ISO 8601 in this case.

     
  • Stephen Colebourne

    Logged In: YES
    user_id=408725
    Originator: NO

    Whilst it may violate part of ISO-8601, it is not a bug in Joda-Time which was never intended to do this. Implementing this is quite a complicated feature request and I don't have any immediate plans to do so.

     

Log in to post a comment.

MongoDB Logo MongoDB