如何在 Azure DocumentDB 中获取当前时间
How can I get the current time in Azure DocumentDB
我正在寻找 MySQL now() 的等价物。任何格式都可以。
这个用户定义函数 (UDF) 应该可以解决问题。
function now() {
return new Date();
}
你可以这样称呼它:
SELECT udf.now(), c.date, c.id FROM c WHERE c.date < udf.now()
截至 2020 年底,Cosmos DB 中有 2 个函数可以获取当前 date/time:
SELECT
GetCurrentDateTime() AS utc_datetime_iso_8601,
GetCurrentTimestamp() AS timestamp_with_milliseconds
returns
[
{
"utc_datetime_iso_8601": "2020-12-25T22:56:27.3453234Z",
"timestamp_with_milliseconds": 1608936987345
}
]
我正在寻找 MySQL now() 的等价物。任何格式都可以。
这个用户定义函数 (UDF) 应该可以解决问题。
function now() {
return new Date();
}
你可以这样称呼它:
SELECT udf.now(), c.date, c.id FROM c WHERE c.date < udf.now()
截至 2020 年底,Cosmos DB 中有 2 个函数可以获取当前 date/time:
SELECT
GetCurrentDateTime() AS utc_datetime_iso_8601,
GetCurrentTimestamp() AS timestamp_with_milliseconds
returns
[
{
"utc_datetime_iso_8601": "2020-12-25T22:56:27.3453234Z",
"timestamp_with_milliseconds": 1608936987345
}
]