Zend Date — day difference

前端 未结 6 1506
温柔的废话
温柔的废话 2020-12-17 20:51

I have the below line of codes

$day1 = new Zend_Date(\'2010-03-01\', \'YYYY-mm-dd\');
$day2 = new Zend_Date(\'2010-03-05\', \'YYYY-mm-dd\');
$dateDiff = $da         


        
6条回答
  •  旧时难觅i
    2020-12-17 21:36

    $firstDay = new Zend_Date('2010-02-28', 'YYYY-MM-dd');
    $lastDay = new Zend_Date('2010-03-01', 'YYYY-MM-dd');
    $diff = $lastDay->sub($firstDay)->toValue();
    $days = ceil($diff/60/60/24) +1;
    

    return $days;

    this gives the right answer

提交回复
热议问题