Answers.Body: <p>Done <a href="https://civicrm.stackexchange.com/users/96/petednz-fuzion">@petednz - fuzion</a></p>
  
  <p>Solved it. I have used this. <code>start_date: {"BETWEEN":["2016-08-13", "2017-08-12"]}</code> Have got the info from support > Developer > API Explorer. I am a newbie in CiviCRM. Was not aware of such a helpful API Explorer.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-10T17:08:32.490Z
Answers.Text: I can't get this to work in the V4 API Explorer. Turns the array into a string ->addWhere('start_date', 'BETWEEN', ['["2021-05-11 00:00:00"', '"2021-05-11 23:59:59"]']). Any idea the correct way to enter the datetime range in the V4 explorer?
Answers.UserDisplayName: wil_SRQ
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-12T07:58:50.730Z
Answers.LastActivityDate: 2016-10-12T07:58:50.730Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: souravb
Body: <p>I am trying to filter a list of memberships based on start dates. My filter consists of From date and To date. I want to get a list of memberships whose start date is between From and To date.</p>
  
  <p>I am using a angular page with wordpress setup. Here is what I have tried so far with no success.</p>
  
  <pre><code>var membership = crmApi('Membership', 'get', {
            status_id: 2, // get memberships with status Current
            start_date_low: "2016-08-13",
            start_date_high: "2017-08-12",
            return: ['contact_id', 'membership_name', 'start_date', 'end_date', 'source']
          });
  return membership;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-09T20:53:49.497Z
Comments.Text: worth changing your comment to an answer imo.
Comments.UserDisplayName: petednz - fuzion
Tags: <wordpress><civicrm-entity>
Title: How to get list of memberships whose start date is between a date range?
ThreadText: # How to get list of memberships whose start date is between a date range?
  
  (Asked by: username_0 on 2016-10-09)
  
  I am trying to filter a list of memberships based on start dates. My filter consists of From date and To date. I want to get a list of memberships whose start date is between From and To date.
  I am using a angular page with wordpress setup. Here is what I have tried so far with no success.
  var membership = crmApi('Membership', 'get', {
            status_id: 2, // get memberships with status Current
            start_date_low: "2016-08-13",
            start_date_high: "2017-08-12",
            return: ['contact_id', 'membership_name', 'start_date', 'end_date', 'source']
          });
  return membership;
  
  **Tags:** wordpress, civicrm-entity
  
  > **Comments:**
  > **username_1**: worth changing your comment to an answer imo.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-10-12. Score: 1 | Accepted answer
  
  Done [@username_1](https://civicrm.stackexchange.com/users/96/petednz-fuzion)
  
  Solved it. I have used this. `start_date: {"BETWEEN":["2016-08-13", "2017-08-12"]}` Have got the info from support > Developer > API Explorer. I am a newbie in CiviCRM. Was not aware of such a helpful API Explorer.
  
  > **Comments:**
  > **username_2**: I can't get this to work in the V4 API Explorer. Turns the array into a string ->addWhere('start_date', 'BETWEEN', ['["2021-05-11 00:00:00"', '"2021-05-11 23:59:59"]']). Any idea the correct way to enter the datetime range in the V4 explorer?  
  
  ---
  
  