Search code examples
xquerymarklogic-10

Convert timestamp to dateTime in MarkLogic


I am using xdmp:document-timestamp function to get the timestamp of the most recent update that happened on this document.

Above function returns timestamp as output like: 16222984921692864.

How can I convert this timestamp 16222984921692864 to the human readable xs:dateTime?


Solution

  • We can use the xdmp:timestamp-to-wallclock function to convert timestamp to dateTime.

    xdmp:timestamp-to-wallclock(16222984921692864)
    

    returns:

    2021-05-29T10:28:12.1692864