Home Tutorial Php Phpdate date_modify

 
 

Share on Google+Share on Google+
date_modify
Posted on: August 26, 2009 at 12:00 AM
Advertisement
In the below example, you will learn about the date_modify function. Learn how to Date Modified with PHP

date_modify() in PHP

date_modify or DateTime::modify function modifies the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). It returns the modify date time.

Description

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

Parameters of Date Modify Function PHP

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

modify - String in a relative format accepted by strtotime().

Example: 

<?php

 

$date = new DateTime("2009-08-25");

 

$date->modify("+1 day");

 

echo $date->format("Y-m-d");

 

?>

Advertisement

Related Tags for date_modify:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 26, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com