简体   繁体   中英

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!

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

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

HTH!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM