axech
axech

Reputation: 31

get data date using <= codeigniter

I have data looking like this

enter image description here

I want show all before 01-08-2018 record (included 01-08-2018) but currently need to fill in 02-08-2018, then able to found 01-08-2018 record

ive tried get data like this this is my where clause:

$this->db->where("a.created_date <=",date("Y-m-d", strtotime($end_date)));

but its only show data before 01-08-2018 record not included 01-08-2018

i really bad in english. please help

Upvotes: 1

Views: 61

Answers (1)

Pradeep
Pradeep

Reputation: 9717

Hope this will help you :

Add date function before a.created_date like this :

$this->db->where("date(a.created_date) <= ", date("Y-m-d", strtotime($end_date)));

For more : https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

Upvotes: 1

Related Questions