Forum Stats

  • 3,826,044 Users
  • 2,260,590 Discussions
  • 7,896,776 Comments

Discussions

calculate date duration in years

user575089
user575089 Member Posts: 466
edited Apr 27, 2017 8:30AM in Java Programming

I have two java util Dates D1 & D2

Date format  dd/MM/yyyy

I want to calculate date duration in years including fractions.

example:  If the duration  is  1 year 6 months 30 days ....then I'd expect output as ( 1+ 6/12 +30/365) = 1.58 yrs (without round off)

Whats is the easy way to do it ?

This discussion has been closed.