PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
- // date to search
- $date = DateTime::createFromFormat('m/d/Y', '10/27/2014');
- $date->setTime(0,0,0);
- // set lowest date value
- $unixDateStart = $date->getTimeStamp();
- // add 1 day and subtract 1 second
- $date->add(new DateInterval('P1D'));
- $date->sub(new DateInterval('PT1S'));
- // set highest date value
- $unixDateEnd = $date->getTimeStamp();
- $query->andFilterWhere(
- ['between', 'created_at', $unixDateStart, $unixDateEnd]);
转载请注明:谷谷点程序 » yii2创建时间搜索的方法