mis*_*irl 2 select codeigniter date
我正在尝试从表格文件中选择日期是今天的日期.我正在使用Codeigniter.但它只显示没有小时的这些文件.我的意思是数据库日期在哪里:2015-06-25 00:00:00.但它没有显示这些文件有一个小时 - 例如:2015-06-25 08:34:00.如何显示日期为当前日期的所有文档,无论是什么时间.
<?php
$date = new DateTime("now");
$curr_date = $date->format('Y-m-d ');
$this->db->select('*');
$this->db->from('documents');
$this->db->where('Date', $curr_date);
$query = $this->db->get();
return $query->result();
Run Code Online (Sandbox Code Playgroud)
试试这个
<?php
$date = new DateTime("now");
$curr_date = $date->format('Y-m-d ');
$this->db->select('*');
$this->db->from('documents');
$this->db->where('DATE(Date)',$curr_date);//use date function
$query = $this->db->get();
return $query->result();
Run Code Online (Sandbox Code Playgroud)