public static int secondsDiff(Date earlierDate, Date laterDate) {
        if (earlierDate == null || laterDate == null) {
            return 0;
        }

        return (int) ((laterDate.getTime() / SECOND_MILLIS) - (earlierDate.getTime() / SECOND_MILLIS));
    }
public static int secondsDiff ( Date earlierDate , Date laterDate ) { if ( earlierDate == null || laterDate == null ) { return 0 ; } return ( int ) ( ( laterDate . getTime ( ) / SECOND_MILLIS ) - ( earlierDate . getTime ( ) / SECOND_MILLIS ) ) ; }
Get the seconds difference