Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

date_modify

Description

The date_modify of Date / Time for PHP alters the timestamp.

Syntax

date_modify ( DateTime $object , string $modify ) : DateTime

Parameters

object

A DateTime object returned by date_create(). The function modifies this object.

modify

A date/time string. Valid formats are explained in Date and Time Formats.

Return

Returns the DateTime object for method chaining or FALSE on failure.

Examples

1 · object modify

<?

$object = date_create();
$modify = "1 year 1 month 1 week 1 day 1 hour 1 minute 1 second";

date_modify($object, $modify);

echo date_format($object, "Y-m-d H:i:s");

?>
2025-08-31 15:52:07

2 · Return

<?

$object = date_create();
$modify = "1 year 1 month 1 week 1 day 1 hour 1 minute 1 second";

$return = date_modify($object, $modify);

var_export($return);

?>
\DateTime::__set_state(array(
   'date' => '2025-08-31 15:52:07.814654',
   'timezone_type' => 3,
   'timezone' => 'UTC',
))
HomeMenu