# Using the BETWEEN search operator for two dates

**URL:** <https://community.hubspot.com/t/using-the-between-search-operator-for-two-dates/55294>\
**Category:** APIs & Integrations\
**Created:** [April 20, 2022, 1:16pm UTC](https://community.hubspot.com/t/using-the-between-search-operator-for-two-dates/55294 "2022-04-20T13:16:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dezachu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dezachu/32/58551_2.png) [@Dezachu](https://community.hubspot.com/u/Dezachu)\
**Post date:** [April 20, 2022, 1:16pm UTC](https://community.hubspot.com/t/using-the-between-search-operator-for-two-dates/55294/1 "2022-04-20T13:16:44Z")

</div>

Hi, we’re trying to write a “get records updated between X and Y dates” interface with the HubSpot API but are finding the BETWEEN operator a bit confusing. The documentation is very light on the ground on how to use it.

Polling /crm/v3/objects/tasks/search, here’s the JSON body.

```lia-code-sample
{
 "filterGroups":[
 {
 "filters":[
 {
 "propertyName":"hs_lastmodifieddate",
 "operator":"BETWEEN",
 "values":[
 "2022-03-01T00:00:00.000Z",
 "2022-04-01T00:00:00.000Z"
 ]
 }
 ]
 }
 ],
 "properties":[
 "hs_timestamp",
 "hs_task_status",
 "hs_lastmodifieddate"
 ]
}

```

This is turning up this error.

_“Invalid input JSON on line 12, column 5: Cannot construct instance of `com.hubspot.inbounddb.publicobject.core.v3.search.Filter`, problem: Error validating request.”_

Any suggestions? I’ve tried changing from “values” to “value” (and get an array-based error), changing to look at hs\_timestamp as a test with numerical values. No joy.

Thanks

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [April 22, 2022, 1:12pm UTC](https://community.hubspot.com/t/using-the-between-search-operator-for-two-dates/55294/2 "2022-04-22T13:12:24Z")

</div>

@Dezachu  
Replace that values array with two new key value pairs.

**“highValue”: xxx,**

**“value”: xxx**

You will also probably need to convert those timestamps into unix timestamps in milliseconds

---

<div class="post-metadata">

**Author:** ![Dezachu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dezachu/32/58551_2.png) [@Dezachu](https://community.hubspot.com/u/Dezachu)\
**Post date:** [April 22, 2022, 1:29pm UTC](https://community.hubspot.com/t/using-the-between-search-operator-for-two-dates/55294/3 "2022-04-22T13:29:40Z")

</div>

Lovely, thanks Dennis.
