Skip to content

Commit 85c064c

Browse files
authored
Merge pull request #89715 from SnehaGunda/LandingPage2
Updating dateTime doc
2 parents 23225d0 + 80e3c07 commit 85c064c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

articles/cosmos-db/working-with-dates.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ ms.date: 07/23/2019
1010
# Working with Dates in Azure Cosmos DB
1111
Azure Cosmos DB delivers schema flexibility and rich indexing via a native [JSON](https://www.json.org) data model. All Azure Cosmos DB resources including databases, containers, documents, and stored procedures are modeled and stored as JSON documents. As a requirement for being portable, JSON (and Azure Cosmos DB) supports only a small set of basic types: String, Number, Boolean, Array, Object, and Null. However, JSON is flexible and allow developers and frameworks to represent more complex types using these primitives and composing them as objects or arrays.
1212

13-
In addition to the basic types, many applications need the [DateTime](https://msdn.microsoft.com/library/system.datetime(v=vs.110).aspx) type to represent dates and timestamps. This article describes how developers can store, retrieve, and query dates in Azure Cosmos DB using the .NET SDK.
13+
In addition to the basic types, many applications need the DateTime type to represent dates and timestamps. This article describes how developers can store, retrieve, and query dates in Azure Cosmos DB using the .NET SDK.
1414

1515
## Storing DateTimes
16-
By default, the [Azure Cosmos DB SDK](sql-api-sdk-dotnet.md) serializes DateTime values as [ISO 8601](https://www.iso.org/iso/catalogue_detail?csnumber=40874) strings. Most applications can use the default string representation for DateTime for the following reasons:
16+
17+
Azure Cosmos DB is scoped to the JSON types which does not include a DateTime type. So, in Azure Cosmos DB, dates must be stored as strings. Currently, Azure Cosmos DB doesn't support localization of dates. The recommended format for DateTime strings in Azure Cosmos DB is `YYYY-MM-DDThh:mm:ss.sssZ` which follows the ISO 8601 UTC standard. Formatting the strings in this format will allow sorting dates lexicographically. Logic to handle non-UTC dates must be defined by the client. Most applications can use the default string representation for DateTime for the following reasons:
1718

1819
* Strings can be compared, and the relative ordering of the DateTime values is preserved when they are transformed to strings.
1920
* This approach doesn't require any custom code or attributes for JSON conversion.

0 commit comments

Comments
 (0)