9

In the Joda-Time library, the Period class represents a period of time including years, months, days, hours, minutes, etc.

However, in Java Time API a Period class can only include a number of years, months and days.

Why can't I include a time in Java's Period object, and what is then the best way to express something like "2 days and 1 hour"?

I am aware of the Duration class, but it doesn't allow to specify "2 days and 1 hour" ; a duration of 49 hours may be different than "2 days and 1 hour" (DST, ...).

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Matthew
  • 10,988
  • 11
  • 54
  • 69
  • 1
    Wondered as well. Related: http://stackoverflow.com/a/25760725/1743880 – Tunaki Jun 08 '16 at 19:06
  • 6
    I found some interesting info regarding this in the [OpenJDK mailing list](http://mail.openjdk.java.net/pipermail/threeten-dev/2013-September.txt) (look for the subject "ISO8601 durations and java.time"). – Tunaki Jun 08 '16 at 19:19
  • This answer pretty much explains the reasons: http://stackoverflow.com/a/32369144/38896 – JodaStephen Jun 09 '16 at 08:23

0 Answers0