Compare one date to another, must be in the DDMMYYYY format.

@return  <0  if the first date is before the second<br>
0   if the dates are the same or the format is invalid<br>
>0  if the first date is after the second
554587
public static int compareToDDMMYYYY(String date1, String date2) {
		if(date1.length()!=8 || date2.length()!=8) return 0;
		return compareToDDMMYYYY0(date1)-compareToDDMMYYYY0(date2);
	}
1309725
function isDayBetween(d, d1, d2) {
  var date = clone(d);
  date.setHours(0, 0, 0, 0);
  return isDayAfter(date, d1) && isDayBefore(date, d2) || isDayAfter(date, d2) && isDayBefore(date, d1);
}
765804
public Date getExpireDate() {
		Date ret = null;
		if (track2 != null) {
			ret = track2.getExpireDate();
		}
		if (ret == null && track1 != null) {
			ret = track1.getExpireDate();
		}
		return ret;
	}
751689
static boolean isAfter(Date a, Date b) {
        return a == null || (b != null && b.after(a));
    }
1150142
public Date getNotBefore() {
        if (info == null)
            return null;
        try {
            Date d = (Date) info.get(CertificateValidity.NAME + DOT +
                                        CertificateValidity.NOT_BEFORE);
            return d;
        } catch (Exception e) {
            return null;
        }
    }
434977
public boolean isSameDay(Day compared)
  {
	  if(compared == null)
		  return false;
	 
  	return this.getMonth() == compared.getMonth()
  	&& this.getDayOfMonth() == compared.getDayOfMonth()
  	&& this.getYear() == compared.getYear();
  }
747035
public int compare(final T first, final T second) {
    if (first.equals(second)) return 0;
    else return first.size() - second.size();
  }
749926
public static boolean isDateEqaualed(final java.util.Date date1, final java.util.Date date2) {
		final String d1 = JKFormatUtil.formatDate(date1, JKFormatUtil.MYSQL_DATE_DB_PATTERN);
		final String d2 = JKFormatUtil.formatDate(date2, JKFormatUtil.MYSQL_DATE_DB_PATTERN);
		return d1.equalsIgnoreCase(d2);
	}
226537
public static function datediff($date1, $date2) {
		ref\sanitize::date($date1);
		ref\sanitize::date($date2);

		// Same or bad dates.
		if (
			! \is_string($date1) ||
			! \is_string($date2) ||
			($date1 === $date2) ||
			('0000-00-00' === $date1) ||
			('0000-00-00' === $date2)
		) {
			return 0;
		}

		// Prefer DateTime.
		if (\class_exists('DateTime')) {
			$date1 = new \DateTime($date1);
			$date2 = new \DateTime($date2);
			$diff = $date1->diff($date2);

			return \abs($diff->days);
		}

		// Fallback to counting seconds.
		$date1 = \strtotime($date1);
		$date2 = \strtotime($date2);
		return \ceil(\abs($date2 - $date1) / 60 / 60 / 24);
	}
1206246
function isDateSame (date1, date2, format) {
  if (date1 && date2) {
    return toDateString(date1, format) === toDateString(date2, format)
  }
  return false
}
1268586
function icaltime_compare(other) {
      var a = this.toUnixTime();
      var b = other.toUnixTime();

      if (a > b) return 1;
      if (b > a) return -1;
      return 0;
    }
119220
static boolean isBefore(Date a, Date b) {
        return a == null || (b != null && b.before(a));
    }
293943
public static boolean isIn(Date date, Date beginDate, Date endDate) {
		if (date instanceof DateTime) {
			return ((DateTime) date).isIn(beginDate, endDate);
		} else {
			return new DateTime(date).isIn(beginDate, endDate);
		}
	}
673897
static public int compare(byte[] first, byte[] second) {
        // choose the shorter array length
        int firstLength = first.length;
        int secondLength = second.length;
        int shorterLength = Math.min(firstLength, secondLength);

        // compare matching bytes
        for (int i = 0; i < shorterLength; i++) {
            int result = Byte.compare(first[i], second[i]);
            if (result != 0) return Integer.signum(result);
        }

        // compare lengths if bytes match
        if (firstLength < secondLength) return -1;
        if (firstLength > secondLength) return 1;

        // must be same length and equal
        return 0;
    }
647761
public static function compareTimeWithoutDate($date1, $date2)
    {
        $date1 = DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 ' . $date1->format('H:i:s'));
        $date2 = DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-01 ' . $date2->format('H:i:s'));
        if ($date1 == $date2) {
            return 0;
        }
        if ($date1 < $date2) {
            return -1;
        }

        return 1;
    }
864290
public static boolean isBetween(final Date start, final Date end, final Date between)
	{
		final long min = start.getTime();
		final long max = end.getTime();
		final long index = between.getTime();
		return min <= index && index <= max;
	}
128255
public static boolean isDateInThePast(final Date date)
	{
		boolean inPast = false;
		final Calendar compare = Calendar.getInstance();
		compare.setTime(date);
		final Calendar now = Calendar.getInstance();
		now.setTime(new Date(System.currentTimeMillis()));
		inPast = now.after(compare);
		return inPast;
	}