MySQL – SELECT * FROM table WHERE date = TODAY

mySQL SELECT WHERE date = today
mySQL SELECT WHERE date = today

The Quick answer is:

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

I was tearing my hair out trying to figure this the other morning and its really quite simple. I thought i may have use a day month year match or possibly use PHP but thankfully the guys at MySQL included this nice DATE() function which means you don’t have to worry about the hours, minutes and seconds being different. Simples!
MySQL DATE / TIME Functions

The functions used in thie MySQL query are:

* DATE() returns the date without time
* NOW() returns the current date & time (note we’ve used the DATE() function in this query to remove the time)

For more information about MySQL Date and Time functions on the official MySQL site.

About the author

My name is Tom Jepson. I'm a Technical SEO freelancer with almost 20 years experience in Search Engine Optimisation. Proud Father, Python enthusiast, Self-confessed tech nerd, Ropey Guitarist and Photographer.

18 thoughts on “MySQL – SELECT * FROM table WHERE date = TODAY”

  1. Here’s the string I used to grab stuff that was created today..
    SELECT * FROM myTable WHERE myDateColumn >= CURDATE()

    Reply
  2. Thanks for the help with the MySQL query.

    By the way, your photos in the sidebar are pointing to an IP on your local network. I wanted to see those bridge pics!!

    Reply

Leave a comment