在codeigniter中如何在两个日期之间找到数据

时间:2014-10-11 06:54:01

标签: php codeigniter

如何在php中的两个日期之间获取数据

$this->db->select('*');
$this->db->from('table_name');
this-> db ->where('t_deadline' between $start_deadline and $end_deadline);

但此查询未执行。

2 个答案:

答案 0 :(得分:2)

$this->db->where('order_date >=', $first_date);
$this->db->where('order_date <=', $second_date);
return $this->db->get('orders');

答案 1 :(得分:0)

试试这个:

$this->db->select('*');
$this->db->from('table_name');
$this->db->where('t_deadline >=', $start_deadline);
$this->db->where('t_deadline <=', $end_deadline);
$query = $this->db->get();
$result = $query->result();
print_r($result);