代码之家  ›  专栏  ›  技术社区  ›  thesunneversets

涉及DateTime的CakePHP查询

  •  1
  • thesunneversets  · 技术社区  · 15 年前

    在CakePHP查询过程中,我在解决如何对datetime字段进行比较时遇到了一些问题。

    例如,我希望能够定期从数据库中删除与过去发生的事件相关的所有记录。但我只得到了:

    $this->Item->deleteAll(
      'conditions'=>array('date'=> ... ),
      false
     );
    

    1 回复  |  直到 15 年前
        1
  •  4
  •   deceze    15 年前
    'conditions' => array('Item.date <' => date('Y-m-d'))