TicksToDateTime (Azure Cosmos DB)TicksToDateTime (Azure Cosmos DB)
适用于:
SQL API
将指定的时钟周期值转换为日期/时间。Converts the specified ticks value to a DateTime.
语法Syntax
TicksToDateTime (<Ticks>)
参数Arguments
TicksTicks
一个有符号的数值,即自 Unix 时间以来 100 纳秒时钟周期的当前数字。A signed numeric value, the current number of 100 nanosecond ticks that have elapsed since the Unix epoch. 换句话说,它是自 1970 年 1 月 1 日星期四 00:00:00 以来 100 纳秒时钟周期的数字。In other words, it is the number of 100 nanosecond ticks that have elapsed since 00:00:00 Thursday, 1 January 1970.
返回类型Return types
以 YYYY-MM-DDThh:mm:ss.fffffffZ
格式返回 UTC 日期和时间 ISO 8601 字符串值,其中:Returns the UTC date and time ISO 8601 string value in the format YYYY-MM-DDThh:mm:ss.fffffffZ
where:
格式Format | 描述Description | |
---|---|---|
YYYYYYYY | 四位数的年份four-digit year | |
MMMM | 两位数的月份(01 = 1 月,依此类推。)two-digit month (01 = January, etc.) | |
DDDD | 两位数的月份日期(01 到 31)two-digit day of month (01 through 31) | |
TT | 时间元素开头的符号signifier for beginning of time elements | |
hhhh | 两位数的小时(00 到 23)two-digit hour (00 through 23) | |
MMmm | 两位数的分钟(00 到 59)two-digit minutes (00 through 59) | |
ssss | 两位数的秒(00 到 59)two-digit seconds (00 through 59) | |
.fffffff.fffffff | 七位数的小数秒seven-digit fractional seconds | |
ZZ | UTC(协调世界时)指示符UTC (Coordinated Universal Time) designator |
备注Remarks
如果指定的时钟周期值无效,TicksToDateTime 将返回 undefined
。TicksToDateTime will return undefined
if the ticks value specified is invalid.
示例Examples
以下示例将时钟周期转换为日期/时间:The following example converts the ticks to a DateTime:
SELECT TicksToDateTime(15943368134575530) AS DateTime
[
{
"DateTime": "2020-07-09T23:20:13.4575530Z"
}
]