Erik Nucibella Erik Nucibella - 5 months ago 9
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

for db you can use the date function

DATE(NOW()) = DATE(your_date)


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