[threeten-dev] ISO8601 durations and java.time
Klaus Malorny
Klaus.Malorny at knipp.de
Thu Sep 12 03:21:55 PDT 2013
Hi,
recently I took a first look on the new API that comes with Java 8 and
discovered something that puzzles me, namely, that there does not seem to exist
a class that can fully represent ISO8601 durations. "Duration" does not
understand months and years, while "Period" does not understand hours, minutes
and seconds/fractions. I have read somewhere about a distinction between a
"human" and a "machine" time line, and for the latter, it may make sense for not
having months and years, but not for the other for not supporting durations
below a day.
I consider not having a class representing ISO8601 durations as problematic, as
these appear here and there in the real world, for example in XML schemas* or in
databases (e.g. PostgreSQL supports something like). One would have to manage
this as a pair of Duration and Period, and would need to have a custom parser
and string conversion. But maybe I simply misunderstand the API. I looked into
the mailing list archive for the recent months, but I did not find any
discussion about it, so I just joined the mailing list to ask about.
Regards,
Klaus
* I also cannot see any interaction of the new API with the
javax.xml.datatype.Duration class
More information about the threeten-dev
mailing list