date_compare_date(date1,date2)

From ENIGMA
Jump to navigation Jump to search

Description

Compares the date of the two given date-time values and returns the result.

Parameters

Parameter Data Type Description
date1 time_t first date-time value to compare
date2 time_t second date-time value to compare

Return Values

integer: Returns -1, 0, or 1 depending on whether the first is smaller, equal, or larger than the second value.

Example Call

// demonstrates comparing the date-time value of the current date to tomorrow
switch (date_compare_date(date_current_date(), date_inc_day(date_current_date(),1))) {
  case -1:
    // first date-time value is smaller than the second
    break;
  case 0:
    // first date-time value is equal the second
    break;
  case 1:
    // first date-time value is larger than the second
    break;
}