GetCurrentTimestamp (Azure Cosmos DB)

APPLIES TO: SQL API

Returns the number of milliseconds that have elapsed since 00:00:00 Thursday, 1 January 1970.

Syntax

GetCurrentTimestamp ()  

Return types

Returns a signed numeric value, the current number of milliseconds that have elapsed since the Unix epoch i.e. the number of milliseconds that have elapsed since 00:00:00 Thursday, 1 January 1970.

Remarks

GetCurrentTimestamp() is a nondeterministic function. The result returned is UTC (Coordinated Universal Time).

Note

This system function will not utilize the index. If you need to compare values to the current time, obtain the current time before query execution and use that constant string value in the WHERE clause.

Examples

The following example shows how to get the current timestamp using the GetCurrentTimestamp() built-in function.

SELECT GetCurrentTimestamp() AS currentUtcTimestamp

Here is an example result set.

[{
  "currentUtcTimestamp": 1556916469065
}]  

Next steps