user549757
user549757

Reputation: 33902

Retrieve records based on Date

I have a date column in my table. Is there any way in mysql to retrieve record based on date excluding the time part?

I have tried appending * but does not seems to work.

SELECT * FROM myTable where filterDate="2010-08-01 *"

Is there any way to do it like this rather then filtering it by using between?

Thanks.

Upvotes: 0

Views: 258

Answers (3)

Imran
Imran

Reputation: 3024

Try this

SELECT DATE_FORMAT(filterDate , '%d-%m-%Y') AS new_date FROM table_name WHERE
DATE_FORMAT(filterDate , '%d-%m-%Y') = '2010-08-01'

Upvotes: 0

Shakti Singh
Shakti Singh

Reputation: 86386

You can use DATE_FORMAT function of mysql

SELECT * FROM myTable where DATE_FORMAT(filterDate,'%Y-%m-%d') ="2010-08-01"

Upvotes: 1

Arthur Halma
Arthur Halma

Reputation: 4001

SELECT * FROM myTable where filterDate LIKE "%2010-08-01 %"

Upvotes: 3

Related Questions