GetCurrentTicks (Azure Cosmos DB)

APPLIES TO: SQL API

Returns the number of 100-nanosecond ticks that have elapsed since 00:00:00 Thursday, 1 January 1970.

Syntax

GetCurrentTicks ()

Return types

Returns a signed numeric value, the current number of 100-nanosecond ticks that have elapsed since the Unix epoch. In other words, GetCurrentTicks returns the number of 100 nanosecond ticks that have elapsed since 00:00:00 Thursday, 1 January 1970.

Remarks

GetCurrentTicks() 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

Here's an example that returns the current time, measured in ticks:

SELECT GetCurrentTicks() AS CurrentTimeInTicks
[
    {
        "CurrentTimeInTicks": 15973607943002652
    }
]

Next steps