XQuery 中是否有任何方法可以获取自某个 Epoch 以来以毫秒为单位的当前时间? [英] Is there any way in XQuery to get the current time in milliseconds since some Epoch?

查看:19
本文介绍了XQuery 中是否有任何方法可以获取自某个 Epoch 以来以毫秒为单位的当前时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XQuery 提供了各种 date/time 函数,如 current-dateTime(),但是我似乎找不到一个可以给我的函数自 Epoch 以来以毫秒为单位的时间.提取小时、分钟和秒的函数似乎过于单独存在.

XQuery offers various date/time functions like current-dateTime(), however I can't seem to find one which gives me the time in milliseconds since Epoch. Functions to extract hours, minutes and seconds seem to exist too individually.

XQuery 中获取 Epoch 时间(即 unix 时间或类似时间)的正确方法是什么?

What is the right way to get the Epoch time (i.e. unix time or similar) in XQuery?

推荐答案

(current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xs:dayTimeDuration('PT0.001S')

返回秒数作为持续时间,然后除以1毫秒得到毫秒数作为数字.

returns the number of seconds as a duration, and then divides by 1 millisecond to get the number of milliseconds as a number.

这篇关于XQuery 中是否有任何方法可以获取自某个 Epoch 以来以毫秒为单位的当前时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆