GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


rsformpro:setting_min_and_max_dates_for_a_date_and_time_picker

Table of Contents

In RsFormPro! you can use PHP as the source of the min and max dates to be enabled in the Date and Time Picker. This means we can programatically set a window. The syntax is a little strange but not incomprehensible.

Min Date

//<code>
return date("m/d/Y", time());
//</code>

Max Date

//<code>
return date("m/d/Y", time()+(59 * 24 * 60 * 60));
//</code>

The time() function in PHP returns the UNIX time. This is useful because the other PHP functions for adding and subtracting from dates are needlessly complex and convoluted. The UNIX time is just an integer so we can do simple math with it.

For our example above, we've starting at today, and allowing +59 days from today. You can of course change this for any date range you wish. Just bear in mind that RsFormsPro wants the date returned in m/d/Y format which is why we're using the Date() function.

/data/webs/external/dokuwiki/data/pages/rsformpro/setting_min_and_max_dates_for_a_date_and_time_picker.txt · Last modified: 2019/05/08 15:21 by genadmin

Was this page helpful?-11+1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki