{"id":1195,"date":"2014-07-17T11:00:39","date_gmt":"2014-07-17T15:00:39","guid":{"rendered":"http:\/\/cfdbplugin.com\/?page_id=1195"},"modified":"2014-10-18T19:18:14","modified_gmt":"2014-10-18T23:18:14","slug":"filtering-on-date-fields","status":"publish","type":"page","link":"https:\/\/cfdbplugin.com\/?page_id=1195","title":{"rendered":"Filtering on Date fields"},"content":{"rendered":"<p>You may have fields in your form that contain dates. In the database, these are saved simply as text. To filter on dates, use the short code <a href=\"http:\/\/cfdbplugin.com\/?page_id=1073\" target=\"_blank\">Filter Function<\/a> capability to apply the PHP <a href=\"http:\/\/php.net\/manual\/en\/function.strtotime.php\" target=\"_blank\">strtotime<\/a> (string-to-time) function in your filter.<\/p>\n<p>(Note: if filtering on special field submit_time, see <a href=\"http:\/\/cfdbplugin.com\/?page_id=553\" target=\"_blank\">Filtering on submit_time<\/a>)<\/p>\n<p>Here is an example from an actual user:<\/p>\n<p><strong>Question:<\/strong><br \/>\nAfter ordering on date I also want to filter on date (not submission-date). Is it possible to filter on dates for example<br \/>\n(1) The last 4 weeks (startpoint = today)<br \/>\n(2)\u00a0Today and coming 7 days<\/p>\n<p><strong>Solution:<\/strong><br \/>\nGiven a &#8220;<strong>Date Form<\/strong>&#8221; with field &#8220;<strong>date<\/strong>&#8221; with values like &#8220;<strong>7\/17\/2014<\/strong>&#8221;<\/p>\n<p>(1) <code>[cfdb-table form=\"Date Form\" <span style=\"color: #0000ff;\">filter=\"strtotime(date)&gt;=strtotime('4 weeks ago')\"<\/span>]<\/code><\/p>\n<p>(2) <code>[cfdb-table form=\"Date Form\" <span style=\"color: #0000ff;\">filter=\"strtotime(date)&gt;=strtotime('today')&amp;&amp;strtotime(date)&lt;=strtotime('+7 days')\"<\/span>]<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Learn more about how to express time comparisons on the\u00a0<a href=\"http:\/\/cfdbplugin.com\/?page_id=553\" target=\"_blank\">Filtering on submit_time<\/a>\u00a0page<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may have fields in your form that contain dates. In the database, these are saved simply as text. To filter on dates, use the short code Filter Function capability to apply the PHP strtotime (string-to-time) function in your filter. (Note: if filtering on special field submit_time, see Filtering on submit_time) Here is an example [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1069,"menu_order":12,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-1195","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1mptf-jh","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1195"}],"version-history":[{"count":6,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1195\/revisions"}],"predecessor-version":[{"id":1201,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1195\/revisions\/1201"}],"up":[{"embeddable":true,"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=\/wp\/v2\/pages\/1069"}],"wp:attachment":[{"href":"https:\/\/cfdbplugin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}