CodeIgniter Forums
How to format date when trying to get all rows created today (active record) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How to format date when trying to get all rows created today (active record) (/showthread.php?tid=42985)



How to format date when trying to get all rows created today (active record) - El Forum - 06-25-2011

[eluser]rvillalon[/eluser]
Hi Everyone... I have the code I'm using below but I'm not sure how to format the date so I can search by date only. Any ideas?

Code:
$this->db->select("DATE_FORMAT(date_added, '%Y-%m-%d') AS date_added", FALSE);  
$this->db->from($this->order_shipping_table_name);
$this->db->join($this->order_table_name, $this->order_table_name . '.order_id = ' . $this->order_shipping_table_name . '.order_id');
$this->db->where($this->order_shipping_table_name . '.seller_id', $seller_id);
$this->db->where($this->order_table_name . '.date_added', '2011-06-25');
$query = $this->db->get();
$num_rows = $query->num_rows();