MarkLogic 12 EA 1 Product Documentation
sql.timestampdiff

sql.timestampdiff(
   dateTimeType as xs.ID,
   timestamp1 as xs.genericDateTimeArg,
   timestamp2 as xs.genericDateTimeArg
) as Number?

Summary

Returns the difference in dateTimeType field of two given timestamps.

Parameters
dateTimeType The dateTimeType of the timestamp where addition should take place. Available types are:

SQL_TSI_FRAC_SECOND

nano seconds

SQL_TSI_SECOND

seconds

SQL_TSI_MINUTE

minute

SQL_TSI_HOUR

hour

SQL_TSI_DAY

day

SQL_TSI_WEEK

week

SQL_TSI_MONTH

month

SQL_TSI_QUARTER

quarter

SQL_TSI_YEAR

year
timestamp1 The integer to add to the given dateTimeType field of the third parameter.
timestamp2 The xs:dateTime timestamp to which addition has to take place.

Example

sql.timestampdiff('SQL_TSI_DAY', '2009-05-20T03:03:03','2009-05-18T03:03:03')
=> |ANON7761991471377004207| |2|
Powered by MarkLogic Server | Terms of Use | Privacy Policy