Expressions.expr-primary-odbc-timestampdiff
Use the TIMESTAMPDIFF function to return the difference between two timestamps.
Format
{{ FN TIMESTAMPDIFF( IntervalType, Timestamp1, Timestamp2 ) }}
Remarks
The difference between the two timestamps is returned as an integer that specifies the number of intervals of IntervalType between Timestamp1 and Timestamp2. Where Timestamp1 and Timestamp2 are any date\time expression.
The following table specifies possible values for IntervalType:
| IntervalType | Description |
|---|---|
| SQL_TSI_FRAC_SECOND | Thousandths of a second |
| SQL_TSI_SECOND | Seconds |
| SQL_TSI_MINUTE | Minutes |
| SQL_TSI_HOUR | Hours |
| SQL_TSI_DAY | Days |
| SQL_TSI_WEEK | Weeks |
| SQL_TSI_MONTH | Months |
| SQL_TSI_QUARTER | Quarters of year |
| SQL_TSI_YEAR | Years |
{ FN TIMESTAMPDIFF( SQL_TSI_MINUTE, TIMESTAMP '2025-08-02 00:00:00', TIMESTAMP '2025-08-02 00:15:00' ) }