MarkLogic Server 11.0 Product Documentation
sql:timestampdiffsql:timestampdiff(
$dateTimeType as xs:ID,
$timestamp1 as xs:genericDateTimeArg,
$timestamp2 as xs:genericDateTimeArg
) as xs:integer?
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
xdmp:sql("select timestampdiff(SQL_TSI_DAY,'2009-05-20T03:03:03','2009-05-18T03:03:03')","format")
=> |ANON7761991471377004207| |2|
Example
sql:timestampdiff('SQL_TSI_DAY', '2009-05-20T03:03:03','2009-05-18T03:03:03')
=> |ANON7761991471377004207| |2|
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.