You're missing the T
before your time elements and minutes should be M
not I
:
If the duration contains time elements, that portion of the specification is preceded by the letter T.
$date->add(
new \DateInterval(
'P' . $years . 'Y'
. $months . 'M'
. $days . 'DT'
. $hours . 'H'
. $minutes . 'M'
. $seconds . 'S'
)
);
You may also want to make your code smarter and simply omit any date/time elements that have zero values.