Search by date range by submitting serach form request

14 posts by 4 authors in: Forums > CMS Builder
Last Post: July 2, 2015   (RSS)

By nmsinc - July 1, 2015

The min and max dates are two separate textfields. The date picker fills the "From" and "to" textfields with the date formatted as: 2015-07-01

The date field for the record to lookup is: 'createdDate'

Thanks - nmsinc

nmsinc

By Dave - July 2, 2015

Ok, got it, thanks.

Try this on the end of your URL and see if it changes the results: ?createdDate_min=2015-07-01+00:00:00

If it does add this code before you call getRecords(): 

if (@$_REQUEST['date_min']) { $_REQUEST['createdDate_min'] = $_REQUEST['date_min'] . ' 00:00:00'; }
if (@$_REQUEST['date_max']) { $_REQUEST['createdDate_max'] = $_REQUEST['date_max'] . ' 00:00:00'; }

And then temporarily add this debugging option to getRecords():

'debugSql' => true,

In addition to the _year, _mon, _day suffixes listed here: http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html

You can also do _min _max search comparisons on dates, it just treats them as a 14 digit number.  I'll update the docs to reflect that.

Let me know if you still have any problems with the above code.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

By Dave - July 2, 2015

Hi nmsinc, 

Do you want to email me FTP/CMS login details and steps to recreate the issue and I'll take a look at the files?  You can email me at dave@interactivetools.com (don't post passwords to the forum).

Thanks!

Dave Edis - Senior Developer
interactivetools.com