in JAVA by
Q:
What distinguishes Period from Duration in Java 8?

1 Answer

0 votes
by

There is a small distinction between Period and Duration, despite the fact that both can be used to compute the distinction between dates in Java. In Java 8, Period is the difference between the two LocalDate values while Length is the difference between the two Instant values. Instead of returning a Duration, the LocalDate till() method returns a Period, which may be used to display a number of days, months, and years that have passed between two dates.

Related questions

+1 vote
asked May 6, 2021 in JAVA by SakshiSharma
+1 vote
asked Feb 1 in JAVA by sharadyadav1986
+1 vote
asked Feb 1 in JAVA by sharadyadav1986
+2 votes
asked Aug 24, 2022 in JAVA by Robin
...