How to query sql with active record for dates between specified times

后端 未结 5 1832
执念已碎
执念已碎 2020-12-16 18:25

I have a database that I want to pull only certain rows that have dates in specified ranges. I\'m not sure how to do this properly in active record. Right now it looks like

5条回答
  •  无人及你
    2020-12-16 18:27

    this is the way . but according to the DATE format you have in the database you have to change 2012-10-01 and 2012-10-03

    $this->db->select('*');
    $this->db->from('topics_list');
    $this->db->where('order_datetime <','2012-10-03');
    $this->db->where('order_datetime >','2012-10-01');
    
    $result = $this->db->get();
    

提交回复
热议问题