Expressions.expr-primary-odbc-timestampdiff

Returns the difference between two timestamps

Format

{{ FN TIMESTAMPDIFF( IntervalType, Timestamp1, Timestamp2 ) }}

Remarks

Returns the difference between two timestamps 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
Example:

{ FN TIMESTAMPDIFF( SQL_TSI_MINUTE, TIMESTAMP '2006-08-02 00:00:00', TIMESTAMP '2006-08-02 00:15:00' ) }


Disclaimer

Geo SCADA Expert 2022