Android examples for java.util:Date Compare
Figure out if a loan is overdue (day after due date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**//from w ww .ja v a2 s . com * Figure out if a loan is overdue (day after due date) * * @param currentDate the current date * @param maturityDate the due date of the load * @return true if the client has an overdue loan */ public static boolean LoanIsOverdue(Date currentDate, Date maturityDate) { Calendar cal = Calendar.getInstance(); cal.setTime(maturityDate); cal.add(Calendar.DATE, 1); Date maturityDatePlusOneDay = cal.getTime(); return currentDate.after(maturityDatePlusOneDay) || currentDate.equals(maturityDatePlusOneDay); } }