Ways to calculate number of years between two dates in Elixir

Viewed 2133

In order the calculate the number of years between two dates I've written the following code on iex:

>date1 = {{2016,3,21},{0,0,0}}
>date2= {{1983,12,27},{0,0,0}}
>:calendar.time_difference(date1,date2)

that returns the number of days between the two dates. Is there another way to calculate the difference?

1 Answers
Related