Start a conversation

Increase in days, months or years

If it is required to increase the days, months or years based on a date.

In this example we are going to increase the months, the first thing we must do is declare a variable that contains the start date; within it, it must contain the field that is required to add, that is, the start date.



Once the data within the variable is obtained, we proceed to declare another variable that in this case is called $newdate that is the one that will contain the sum that will be added to the current or start date, for them we will use a function of php "strtotime" that is the one that will allow us to make an increase to the current day, and that reflect it in the end date.

Then within the same variable and with the calculations we use the date function that we use to format our new date.



And finally to reflect that increase to the date field of completion, we match it to the variable $newdate that contains the calculated date.




And if we require that no data be inserted into the calculated field, we can use the macro sc_field_readonly that will allow us to block the field, which in order to block it must be on.

With the following format:  sc_field_readonly({Field}, on/off) 



Here we can see the example already finished:

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Silvana Vargas

  2. Posted

Comments