-3

I am trying to achieve a functionality for a membership App but am find some difficulties working with Dates.

I retrieve a startDate from the DB which comes as "YYYY-MM-dd". What I wish to achieve is to calculate the difference in day from the currentDate to the startDate store it in a variable int result

if result > 365 textView.setText("Membership expired");

If anyone can point me in the right direction, I'll be really grateful.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

you can use code below to calculate the days between currentdate and startdate.

(currentDate - startDate) / (1000*3600*24)
Pan
  • 97
  • 3