Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create UTC timestamp using XQuery in MarkLogic?

I feel I must have missed something but I just could not figure out how to create a UTC timestamp in MarkLogic using XQuery. The fn:current-dateTime function creates timestamp with timezone offset specified by the OS.

This is trivial using Server-side JavaScript:

new Date().toISOString()

// 2020-02-07T14:43:32.588Z

Thank you!

like image 266
Fan Li Avatar asked May 17 '26 00:05

Fan Li


1 Answers

You can adjust timezone with the appropriate fn functions, like this:

fn:adjust-dateTime-to-timezone(fn:current-dateTime(), xs:dayTimeDuration("PT0H"))

HTH!

like image 55
grtjn Avatar answered May 18 '26 14:05

grtjn