I'm familiar with the the date and time classes in the JDK and their associated formatting methods. I may be blind, but I cannot find an equivalent set of classes for processing time intervals. For example, I would like to display the number of days for a given long value of milliseconds. I realize that the method to do these conversions is quite simple, however when you factor in internationalization and localization support this becomes less trivial.
I'm surprised that the JDK is missing support for interval processing. However, databases such as Postgresql support it.
Basically what I'm looking for in the JDK (if I'm too blind to see it) or in a third party library is the following functionality:
- Time calculation methods. Such as milliseconds to weeks or seconds to nanoseconds. Although the math is simple for these operations, having an API to go through seems more self-documenting to me.
- Time interval formatting functions that format according to the passed Locale like DateFormat works. For example, in EN_US I would assume that 10 days is well "10 days" and in Japanese I would want "10日" returned.
Is there anything out there or is this a canidate for a new open-source project?