DateTime
PHP Manual

DateTime::modify

(PHP 5 >= 5.2.0)

DateTime::modifyAlters the timestamp

Opis

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().

Parametry

object

Tylko styl proceduralny: Obiekt DateTime zwracany przez date_create()

modify

String in a relative format accepted by strtotime().

Zwracane wartości

Returns the modified DateTime.

Rejestr zmian

Wersja Opis
5.3.0Zmieniono zwracaną wartość z NULL na DateTime.

Przykłady

Przykład #1 A date_modify() example

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

Powyższy przykład wyświetli:

2006-12-13

Zobacz też:


DateTime
PHP Manual