Created
July 4, 2016 13:22
-
-
Save ableasdale/2f675306e79cc24e0124c18269582aba to your computer and use it in GitHub Desktop.
MarkLogic / XQuery: dealing with date (duration) calculations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare variable $dt as xs:dateTime := fn:current-dateTime(); | |
element data { | |
element current {$dt}, | |
element current-minus-seven-days {$dt - xs:dayTimeDuration('P7D')}, | |
element current-plus-seven-days {$dt + xs:dayTimeDuration('P7D')}, | |
element current-plus-one-hour {$dt + xs:dayTimeDuration('PT1H')} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment