In this article, you will learn how to modify the existing timestamp value in PHP. The date_modify() function updates or changes the Timestamp value.

What is the syntax of the date_modify() function in PHP?

date_modify(object, modify)
ParameterDetails
objectThe DateTime instance created by date_create() – Required
modifyThe new date/time string – Required
PHP date_modify() method

Examples of the date_modify function

<?php
$d=date_create("2032-01-04");
date_modify($d,"+4 days");
echo date_format($d,"Y-m-d");
?>