Skip to content

Support for times greater than 24:00 #169

@mjustin

Description

@mjustin

Some domains have time-of-day notations greater than 24:00, indicating that although the given time value may occur on the next calendar day, it is still associated with the previous day.

Per Wikipedia:

Time-of-day notations beyond 24:00 (such as 24:01 or 25:00 instead of 00:01 or 01:00) are not commonly used and not covered by the relevant standards. However, they have been used occasionally in some special contexts in [various countries] where business hours extend beyond midnight, such as broadcast television production and scheduling.

For instance, 25:30 on 7/1/2020 would represent the same point on the timeline as 1:30 on 7/2/2020. However, within the application context the time is still associated with the previous day (e.g. it would be displayed or billed or whatever with the previous day's data).

From what I can tell, both java.time and Threeten-Extra assume a 24-hour clock, and do not store or parse values at or greater than 24:00.

Support for this view of time seems a natural fit for ThreeTen Extra.

It would be useful to be able to pass around instances of this type, parse to/from String representation, do temporal operations on it, convert it to standard wall-clock time, etc.

This view of time would be applicable to the various types that use time. For my use case, LocalTime, LocalDateTime, ZonedDateTime would probably be what I'd need. It looks like it would be applicable to OffsetTime and OffsetDateTime as well.

I'm not sure what the best way to fit this into the javax.time API would be, if it's a whole new set of types analogous to the existing Time type, or if there's a different way to approach this.

Related StackOverflow question

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions