04da356a
by Francis De Brabandere at 2026-05-07T15:32:25-04:00
vbscript: Implement DateDiff built-in function.
Implement DateDiff(interval, date1, date2 [, firstdayofweek [, firstweekofyear]])
with support for all interval types: yyyy, q, m, y, d, w, ww, h, n, s.
For yyyy/q/m the difference is computed from calendar fields via VarUdateFromDate.
For d/y the day number difference is used. For w it is the day difference
integer-divided by 7 (not affected by firstdayofweek). For ww it counts
week boundary crossings based on firstdayofweek. For h/n/s the dates are
converted to the respective unit and truncated before subtracting.
Returns VT_I4 (Long). Null date arguments return Null; null interval or
null firstdayofweek/firstweekofyear return VBSE_ILLEGAL_NULL_USE.