Use date_interval_create_from_date_string() to add 1 year and 35 days to a date.
<?php $date = date_create(‘2019-01-01’); date_add($date, date_interval_create_from_date_string(‘1 year 35 days’)); echo date_format($date, ‘Y-m-d’); ?> |
The date_interval_create_from_date_string() function creates a DateInterval object based on the relative parts specified in the string.
date_interval_create_from_date_string(datetime) |
Parameter |
Description |
datetime |
Required. Specifies a DateInterval. |
Return Value: |
Returns a new DateInterval object. |
PHP Version: |
5.3+ |