date - Best way to compare LocalDates -


this question has answer here:

i have 2 localdate objects. want find out how many days there between 2 events:

if(math.abs(userbirthday - eventdate) <= 5)     // give discount 

do have suggestions how in sophisticated way?

i found solution, please confirm it's correct way of doing this:

math.abs(userbirthday.toepochday() - eventdate.toepochday()) >= 5 

Comments