Date diff ( difference)
We can get difference of two dates by using diff function. Note that this function is supported by PHP 5.3 and higher versions.
Here is an example of knowing the difference in two dates , the first date is taken as present date and past date is created by using date object.
The output is here
$date1=new DateTime("now") ;
echo $date1->format('d-m-y H:i:s');
echo $date->format('%y Years, %m Months, %d Days');
35 Years, 10 Months, 0 Days
Be the first to post comment on this article :