Skip to content

Commit c1799b1

Browse files
committed
Add GetCurrentTimestampStatic
1 parent 137f5bf commit c1799b1

File tree

1 file changed

+4
-48
lines changed

1 file changed

+4
-48
lines changed

articles/cosmos-db/nosql/query/getcurrenttimestampstatic.md

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.reviewer: sidandrews
88
ms.service: cosmos-db
99
ms.subservice: nosql
1010
ms.topic: reference
11-
ms.date: 07/01/2023
11+
ms.date: 07/19/2023
1212
ms.custom: query-reference
1313
---
1414

@@ -35,57 +35,13 @@ Returns a signed numeric value that represents the current number of millisecond
3535

3636
This example uses a container with a partition key path of `/pk`. There are three items in the container with two items within the same logical partition, and one item in a different logical partition.
3737

38-
```json
39-
[
40-
{
41-
"id": "1",
42-
"pk": "A"
43-
},
44-
{
45-
"id": "2",
46-
"pk": "A"
47-
},
48-
{
49-
"id": "3",
50-
"pk": "B"
51-
}
52-
]
53-
```
38+
:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/getcurrenttimestampstatic/seed.novalidate.json" highlight="4,8,12":::
5439

5540
This function returns the same static timestamp for items within the same partition. For comparison, the nonstatic function gets a new timestamp value for each item matched by the query.
5641

57-
```sql
58-
SELECT
59-
i.id,
60-
i.pk AS partitionKey,
61-
GetCurrentTimestamp() AS nonStaticTimestamp,
62-
GetCurrentTimestampStatic() AS staticTimestamp
63-
FROM
64-
items i
65-
```
42+
:::code language="sql" source="~/cosmos-db-nosql-query-samples/scripts/getcurrenttimestampstatic/query.novalidate.sql" highlight="4-5":::
6643

67-
```json
68-
[
69-
{
70-
"id": "1",
71-
"partitionKey": "A",
72-
"nonStaticTimestamp": 1687977636235,
73-
"staticTimestamp": 1687977636232
74-
},
75-
{
76-
"id": "2",
77-
"partitionKey": "A",
78-
"nonStaticTimestamp": 1687977636235,
79-
"staticTimestamp": 1687977636232
80-
},
81-
{
82-
"id": "3",
83-
"partitionKey": "B",
84-
"nonStaticTimestamp": 1687977636238,
85-
"staticTimestamp": 1687977636237
86-
}
87-
]
88-
```
44+
:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/getcurrenttimestampstatic/result.novalidate.json":::
8945

9046
> [!NOTE]
9147
> It's possible for items in different logical partitions to exist in the same physical partition. In this scenario, the static date and time value would be identical.

0 commit comments

Comments
 (0)