Returns the difference between two TIMESTAMP variables as a number of milliseconds.
TimestampDifference(TIMESTAMP Timestamp1, TIMESTAMP Timestamp2 [, INT Part [, INT bCumulative]])
The TIMESTAMP variable 1.
The TIMESTAMP variable 2.
The type of time units being used for the result:
0 – Result is in years.
1 – Result is in months.
2 – Result is in days.
3 - Result is in hours
4 - Result is in minutes.
5 - Result is in seconds (default).
6 - Result is in milliseconds.
Defines how to pass results which values are greater than their time units (see example below).
0 – Non-cumulative
1 – Cumulative mode (default).
The time period between Timestamp1 and Timestamp2. The value is equal or greater than zero. If error, returns 0 with an error code.
TimestampAdd, TimestampCurrent, TimestampSub, TimestampToStr, TimestampCreate, TimestampFormat, TimestampGetPart, TimestampToTimeInt, TimeIntToTimestamp
TIMESTAMP t1 = TimestampCreate(2008, 11, 28, 09, 01, 30);
TIMESTAMP t2 = TimestampCreate(2008, 11, 28, 09, 00, 00);
INT nTimespanCumulative = TimestampDifference(t1, t2, 5, 0);
// nTimespanCumulative is equal 90 (seconds)
INT nTimespanNonCumulative = TimestampDifference(t1, t2, 5, 1);
// nTimespanNonCumulative is equal 30 (seconds)