Freelance PHP programmer India | Freelance web developer india | Web development India | web developer CV india | Compiling PHP and Apache 2 from source on Linux
DateTime
PHP Manual

DateTime::modify

(No version information available, might be only in CVS)

DateTime::modifyAlters the timestamp

Description

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

Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().

Parameters

object

Procedural style only: A DateTime object returned by date_create()

modify

String in a relative format accepted by strtotime().

Return Values

Returns the modified DateTime.

Examples

Example #1 A date_modify() example

<?php
$date 
= new DateTime("2006-12-12");
$date->modify("+1 day");
echo 
$date->format("Y-m-d");
?>

The above example will output:

2006-12-13

See Also


DateTime
PHP Manual