Reputation: 1
I want to migrate JODA time period API to JAVA time (java 8).
Joda time period API supports both time and date.eg. It supports from milliseconds to year. But in java.time we have 2 separate functionality 1.Period which is date API and support from day to year 2.Duration is time API which supports from millisecond to hours. I am currently using Duration API but facing problem when I am using Duration for month eg. I want to add February month for which Duration.month is by default taking 30 days. Is there any solution available in java which supports both date and time API at same time?
I have tried using java.time period and duration API but both are having their specific limits. I want solution in java which supports both time and date API.
Upvotes: 0
Views: 91
Reputation: 63445
No class is supplied in java.time.*
to do this. But extra things that did not fit in the JDK are available in ThreeTen-Extre. In this case, the class PerdodDuration
is appropriate, which combines a Period
and a Duration
. (The two concepts are sufficiently different, particularly wrt days, that they are generally best treated separately.)
Upvotes: 0