Hi, how can I get default date value on field1 and then set f.e. field2 = form1+2months+10days ?
Hi, how can I get default date value on field1 and then set f.e. field2 = form1+2months+10days ?
To get a default value, do this:
$today = New DateTime();
echo $date->format('Y-m-d')
To add 2 months and 10 days, you can do this:
$interval = new DateInterval('P2M10D');
$today->add($interval);
echo $today->format('Y-m-d'); // This is not not today, but added 2 months and 10 days
References:
DateInterval
DateTime