DateTimeDiff

Date/Time 
SYNTAX  DateTimeDiff( arg1, arg2 ) 
RETURNS  NUMBER or ARRAY 
FUNCTION  DateTimeDiff( arg1, arg2 ) which will return positive values if arg1 > arg2 and negative values if arg1 < arg2.
The difference is given in seconds. The function can operate on scalar and array arguments, returning scalar if both inputs are scalars, and array otherwise. It is important to understand that DateTime is not a simple number but rather bitset and two datetime values can only be reliably compared for equlity or inequality using == or != operators. Any other comparisions (less than/greater then), using normal operators > < may sometimes lead to wrong results (if one of dates compared is pre1964), therefore to compare two datetime numbers reliably you should use DateTimeDiff. 
EXAMPLE  
SEE ALSO  DateTime() function 
The DateTimeDiff function is used in the following formulas in AFL online library:
See updated/extended version online.