The mi_datetime_compare() function
The mi_datetime_compare() function compares two binary (internal) DATETIME values and returns an integer value that indicates whether the first value is before, equal to, or after the second value.
Syntax
mi_integer
mi_datetime_compare(mi_datetime *dtime1, mi_datetime *dtime2,
mi_integer *result)
- dtime1
- is a pointer to an internal DATETIME representation of the date, time, or date and time value.
- dtime2
- is a pointer to an internal DATETIME representation of the date, time, or date and time value.
- result
- is a pointer to the result of the comparison.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
No | Yes |
Usage
Use the mi_datetime_compare() function to compare the dates and times in two DATETIME values. If successful, the function returns MI_OK and sets the result variable to one of the following values:- -2
- indicates that one or both of the DATETIME values passed are NULL and cannot be compared.
- -1
- indicates that the value of dtime1 is before the value of dtime2.
- 0
- indicates that the value of dtime1 is equal to the value of dtime2.
- 1
- indicates that the value of dtime1 is after the value of dtime2.
Return values
- MI_OK
- indicates that the function was successful and that the value of the result variable was set.
- -7520
- indicates that one of the arguments passed is a NULL pointer.
- -1263
- indicates that a field in a DATETIME data type is out of range, incorrect, or missing.
- -1266
- indicates that the DATETIME values are incompatible for the operation.
- -1268
- indicates that there is an invalid DATETIME qualifier.