Date Filters - HL Vanilla Community
<main> <article class="userContent"> <p>There are many endpoints that enable you to filter on a date, such as the date that a record was inserted or updated. In these cases, you can filter based on a range of values.</p><h2 data-id="date-formats">Date formats</h2><p>The most simple filter is to specify a date and check for equality. When doing so, use the <a href="https://www.ietf.org/rfc/rfc3339.txt" rel="nofollow noreferrer ugc">RFC3339</a> format. For example:</p><pre class="code codeBlock" spellcheck="false" tabindex="0">2018-12-25 1985-04-12T23:20:50.52Z 1996-12-19T16:39:57-08:00 2018-12-25 </pre><p>This is a flexible, unambiguous format that allows you to specify a date, date/time, and time zones.</p><h2 data-id="basic-date-operations">Basic date operations</h2><p>Typically, you don’t want to filter on an exact date, but rather to specify an operation. To do this, put one of the following operations before the date: <code class="code codeInline" spellcheck="false" tabindex="0">=</code>, <code class="code codeInline" spellcheck="false" tabindex="0">></code>, <code class="code codeInline" spellcheck="false" tabindex="0"><</code>, <code class="code codeInline" spellcheck="false" tabindex="0">>=</code>, <code class="code codeInline" spellcheck="false" tabindex="0"><=</code> </p><pre class="code codeBlock" spellcheck="false" tabindex="0">>2013-01-24 <=2019-12-31T23:59:59Z </pre><h2 data-id="date-ranges">Date ranges</h2><p>You can also filter based on <strong>date ranges</strong>. To do this, insert two dates between brackets, separated by a comma. You can use <strong>square brackets</strong> <code class="code codeInline" spellcheck="false" tabindex="0">[]</code> for inclusive ranges and <strong>round brackets</strong> <code class="code codeInline" spellcheck="false" tabindex="0">()</code> for exclusive ranges. You can also mix and match brackets.</p><pre class="code codeBlock" spellcheck="false" tabindex="0">[2013-03-04,2013-03-04T23:20:50.52Z] [2018-01-01,2019-01-01) // anything in 2018 </pre><h2 data-id="date-filters-must-be-encoded">Date filters must be encoded</h2><p>Most date filters are supplied in the query string, meaning they have to be encoded just like any other query-string parameter. Most dates will work regardless of encoding, but it is considered a best practice to always encode.</p> </article> </main>