Erik Nucibella Erik Nucibella - 1 year ago 58
SQL Question

How to compare the date of a timestamp with a date?

I want to compare just the date of a timestamp in my MYSQL server with the curdate() function. How can i take just the data from the timestamp field in my DB? ( It contains date + time) Cheers!

Answer Source

for db you can use the date function

DATE(NOW()) = DATE(your_date)

select * from my_table 
where  DATE(curdate()) = DATE(your_date);