Reputation: 3214
I'm trying to compare the current date to the a column with a date string but no rows are being returned. next_reminder
is the name of the column with the date string in the format 2015-09-09
SELECT * FROM my_reminders
WHERE DATEDIFF(now(),STR_TO_DATE(next_reminder,'%m/%d/%Y')) == 0
ORDER BY ID DESC;
How do i solve this? Row should be returned because today's date is 2015-09-09
Upvotes: 0
Views: 378
Reputation: 617
You can use the function curdate() to get current datetime and convert that to a date (using the date function) like this
SELECT * FROM my_reminders
WHERE date(next_reminder) = curdate()
ORDER BY ID DESC;
Upvotes: 2