Datetime Comparison in Cosmos Database with NOSQL Query

35 - 14-Mar-2025
Description

While using cosmos database we generally use LINQ to do all the comparison. But, in some cases we need the data to be filtered in using the NOSQL query only.  

In cosmos we need to compare the dates in a particular format yyyy-MM-ddTHH:mm:ss.fffffffZ

Example

SELECT * FROM c WHERE (c["CreatedOn"] >= "2024-02-19T23:14:25.7251173Z")
OR
SELECT * FROM c WHERE c.CreatedOn >= "2024-02-19T23:14:25.7251173Z"

Here the key point is the format of the date string(yyyy-MM-ddTHH:mm:ss.fffffffZ) which we have to compare.

Comments
Load more comments.
Please Login or Sign up to comment.

Search Gyanva

Press "Enter" to search.

More from Publication

What we offer ?

We offer you a platform to publish your experience, knowledge and research with rest of the world. All you need is to sign up and create your own publication on Gyanva.
logo
facebook youtube