PHP date_create() Function
What is a Date Create Function?
Explanation
The "date_create()" function is used to return a new Date Time Object.
Syntax:
date_create ([string $time= "now" [,DateTimeZone $timezone= NULL]])
The default value for "time" is now, timezone is the value of the time.
Example :
<?php
date_default_timezone_set ("America/New_York");
$datetime = date_create('12/15/2007');
$date_object->modify("+5 day");
echo $date_object->format("Y-m-d");
?>
Result :
2007-12-20
In the above date_create() example the timezone is set to "America/New_York", here the date object is created adding 5 days to the existing date.
Note: (PHP 5 >= 5.2.0)