Help solve the problem.

It is necessary to calculate whether the payment deadline for the fine has passed or not (70 days).

Suppose today is December 23, the fine was October 15, the program should show 70 days have passed or not, and how to designate it?

    2 answers 2

    70 days is 6048000000 milliseconds.

    Further elementary (the numbering of the months starts from zero):

    private boolean isOverdue(int year, int month, int date, int hour, int minute) { Calendar curDate = Calendar.getInstance(); Calendar fineDate = Calendar.getInstance(); fineDate.set(year, month, date, hour, minute); return curDate.getTimeInMillis() - fineDate.getTimeInMillis() > 6048000000L; } 

    The date of the penalty is passed to the method. The method calculates the number of milliseconds between the penalty date and the current date, and, depending on the result, returns the corresponding logical value.

    Do not forget to add a check for correct dates.

    Ps. If you are using Java 8, then using java.time , the required can be obtained somewhat easier.

      I advise you to study this page http://developer.alexanderklimov.ru/android/java/date.php