[threeten-dev] ISO8601 durations and java.time
roger riggs
roger.riggs at oracle.com
Thu Sep 12 06:18:47 PDT 2013
Hi Klaus,
Can you remind me of the use cases? Something like 2 years 3 months 1
second
would seem like a work around for some other problem.
I would also be interested to know how the support in XML or PostgreSQL
for date and time periods is used in practice?
Roger
On 9/12/2013 6:21 AM, Klaus Malorny wrote:
>
>
> 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