<?php
function calc_days($start,$end){

    $start_time = strtotime($start);
    $end_time  = strtotime($end);
    $result = (int)(($end_time - $start_time)/86400);

    return $result;
}

$date_1 = "2007-01-01";
$date_2 = "2007-01-15";
echo calc_days($date_1, $date_2);
?>
Published in: PHP
Download

Related snippets