Mega Code Archive

 
Categories / Android / Date Type
 

Checks if the first parameter is before the second parameter in time

import java.util.Date; class Main{     /**      * Checks if the first parameter is before the second parameter in time.      * @param date1 The first date to compare.      * @param date2 The second date to compare.      * @return True if the first date in time is before the second, if not false.      */     public static boolean isBefore(Date date1, Date date2) {         if (date1.compareTo(date2)<0) {             return true;         }         return false;     } }