I will use Timer() to execute function by 5 minutes in Kotlin.
And when I execute function by 5m, if a day passed,I want count var to be 0.
So my idea was
declare two
varsvar todayDate = LocalDate.now() // 2019-09-23 var todayCount:Int = 0After that I will check this vars in 5 minutes by using
Timer()
Then todayDate value differs from previous todayDate, then I can detect date change.
However, I don't know how to compare current todayDate and previous todayDate.
Any idea? or is there any other way to know day change?