I have the following code 2 count days between 2 dates:
$start = '2013-04-02';
$end = '';
if($end){
$now = $end;
}else{
$now = time();
}
$your_date = strtotime($start);
$datediff = $now - $your_date;
echo floor($datediff/(60*60*24));
This works fine and calculates the correct amount of days.
When i enter a end date like this:
$start = '2013-04-02';
$end = '2013-09-11';
if($end){
$now = $end;
}else{
$now = time();
}
$your_date = strtotime($start);
$datediff = $now - $your_date;
echo floor($datediff/(60*60*24));
I get a result of -15797.
Does the above seem ok? Or am i doing something wrong?