php datetime diff days code example
Example 1: php get day diff
$now = time(); // or your date as well
$your_date = strtotime("2010-01-31");
$datediff = $now - $your_date;
echo round($datediff / (60 * 60 * 24));
Example 2: whats the difference between using date function and DATETime in php
function weeknumber($ddate) {
$date = new DateTime($ddate);
return $date->format('W');
}