SELECT records with Today’s Date

I came across this little snippet for querying records where a date field matches today’s date.


SELECT * FROM myTable WHERE DATE(myDate) = DATE(NOW())

Using the date function to make sure that only the date portion is returned without the time makes it a quick query that does not require using an external programming language to try and format today’s date correctly for selecting records.

 

reference: http://www.tomjepson.co.uk/mysql-select-from-table-where-date-today/

Close Menu