Created
August 19, 2014 18:49
-
-
Save arolle/57c6a76c4586493e5eee to your computer and use it in GitHub Desktop.
XQuery: Unix timestamp from dateTime
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
(:~ | |
: unix time from dateTime | |
: @param dateTime | |
: @return unix timestamp of the supplied datetime | |
:) | |
declare local:dateTime-to-timestamp( | |
$dateTime as xs:dateTime | |
) as xs:integer { | |
let $dayZero := xs:dateTime('1970-01-01T00:00:00-00:00') | |
return | |
($dateTime - $dayZero) div xs:dayTimeDuration('PT1S') | |
} | |
() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment