Erik Nucibella Erik Nucibella - 4 months ago 5x
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!


for db you can use the date function

DATE(NOW()) = DATE(your_date)

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