Date operation

In this article we will describe how to make some calculations with Dates. The following script will add a Date field with a numeric field.

The following fields will need to be created:

Field1 - text box with this code to the default value:
return date('m/d/o');
This snippet will return the current date. Of course you can also use the calendar to select a specific date.

Field2 - text box with "Numeric" validation rule

Field3 - hidden field

For the next step you will have to set the Field3 value with the result of the desired calculation. To achieve this just paste the following code in the "Scripts" tab, on "Scripts called on form process":
$_POST['form']['Field3'] = date('m/d/Y',strtotime(' +'.$_POST['form']['Field2'].' days'));
To display this result in the front-end just use the appropriate placeholder (eg. {Field3:value}).