Compare 2 naive_date_time's, diference in days and hours

Given 2 naive_date_time’s, how can I determine the amount of hours they’re different at? I need to determine whether they’re different in more than 24 hours. Should I always compare their days, months, years and the hours? Not only hours?

Is there a way to subtract one from the other and get the amount of hours > 24? This would be easier for me.

Check out NaiveDateTime.diff/2

3 Likes