how i can know how many days between 2 date by php? [duplicate]
Possible Duplicates:
How to count days between two dates in PHP? Full Days between two dates in PHP?
how i can know how many days between 2 date ex: i want know how many days between 12\02\2011 and 15\03\2011
please help me
<?php
$datetime1 = date_create('2011-02-12');
$datetime2 = date_create('2012-03-15');
$interval = date_diff($datetime1, $datetime2);
echo $interval->format('%R%a days');
?>
You dates just have to be of one of the following formats:
PHP Date formats
http://ca.php.net/manual/en/datetime.diff.php
look at the example. it gives you pretty much exactly what you asked.
精彩评论