Erik Nucibella Erik Nucibella -5 years ago 104
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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download