Start a new topic

Nativescript/Kinvey - querying data between two calendar dates


We have a requirement to get the data entered between two calendar dates. We are using Nativescript/Javascript and Kinvey as backend. Can someone share some examples of Date Query operations?

Hello Raghavendra,

I am not familiar with NativeScript but I would still like to provide you with a suggestion. I will also ask my colleague to check this because he has good knowledge of NativeScript.

You can query the records in a specific timeframe using "$gte" (greater than or equal to) and "$lte" (less than or equal to) on  '_kmd.lmt' values ("kmd" means Kinvey Meta Data and "lmt" means Last  Modified Time).

Let's say, you have following timestamps and you want to get all the records modified between those 2 timestamps:

2018-02-19T06:42:36.862Z - Mon, 19 Feb 2018 06:42:36 +00:00

2018-07-13T04:28:38.479Z - Fri, 13 Jul 2018 04:28:38 +00:00

Now you want to get all the records modified between above 2 timestamps i.e. modified after 19th Feb and before 13th July. Your query in the Kinvey API console should be:





Thanks Pranav!!

It would be nice to understand how to write this query in Nativescript, as the API's are different.

Hi Raghavendra,

I assume you are using Kinvey Nativescript SDK. Then you may use the operators described here -

So for the dates the query would look like this:

const query = new Kinvey.Query();
query.greaterThanOrEqualTo('_kmd.lmt', "2018-02-19").lessThanOrEqualTo('_kmd.lmt', "2018-07-13");

Let me know if this has helped.

Martin Apostolov

Thanks Martin!!!

Appreciate your help!!

Login or Signup to post a comment