CakePHP find condition for a query between two dates

前端 未结 6 1164
谎友^
谎友^ 2020-12-30 08:59

I have a start and an end date in my database and a $date variable from a form field. I am now trying to query all the rows where $date is either = start/end date in the db,

6条回答
  •  庸人自扰
    2020-12-30 09:50

    Use this

           $today = new DateTime( date('Y-m-d'));
    
           $fiveYearsBack = $today->sub(new DateInterval('P5Y'));
    

提交回复
热议问题