Created
October 10, 2019 18:46
-
-
Save prestonmcgowan/449774137b15f013e528861afb3e2c2a to your computer and use it in GitHub Desktop.
Convert epoch time to xs:dateTime in XQuery
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
let $epoch := 1397215825 | |
let $dtd := xs:dayTimeDuration(fn:concat('PT', $epoch, 'S')) | |
let $dt := xs:dateTime("1970-01-01T00:00:00-00:00") + $dtd | |
let $re-epoch := ( $dt - xs:dateTime("1970-01-01T00:00:00-00:00") ) div xs:dayTimeDuration('PT1S') | |
return ($epoch, $dt, $re-epoch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment