Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.5 KB

getcurrentticks.md

File metadata and controls

50 lines (35 loc) · 1.5 KB
title titleSuffix description author ms.author ms.reviewer ms.service ms.subservice ms.topic ms.devlang ms.date ms.custom
GetCurrentTicks
Azure Cosmos DB for NoSQL
An Azure Cosmos DB for NoSQL system function that returns a nanosecond ticks value.
jcodella
jacodel
sidandrews
cosmos-db
nosql
reference
nosql
02/27/2024
query-reference

GetCurrentTicks (NoSQL query)

[!INCLUDENoSQL]

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 that represents the current number of 100-nanosecond ticks that have elapsed since the Unix epoch (00:00:00 Thursday, 1 January 1970).

Examples

The following example returns the current time measured in ticks:

:::code language="nosql" source="~/cosmos-db-nosql-query-samples/scripts/getcurrentticks/query.novalidate.sql" highlight="2":::

:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/getcurrentticks/result.novalidate.json":::

Remarks

  • This function is nondeterministic.
  • The result returned is UTC (Coordinated Universal Time).
  • This function doesn't use 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.

Related content