To select all event from MySQL varchar date, that start from tomorrow onwards, for that we have a easy method via usingĀ STR_TO_DATE function.It convert stored date and compare with CURDATE() function
Here in this example I have an even table, in that table event start date is stored in the filed named event_start_time, my requirement is to fetch all event that is greater than today date and ineed in the event date ascending order.
See MySQL query
SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') > CURDATE() ORDER BY STR_TO_DATE(event_start_time,'%d-%m-%Y') Asc
To Fetch coming 7 days data event
SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') > CURDATE() AND STR_TO_DATE(event_start_time, '%d-%m-%Y') <= CURDATE() + INTERVAL 7 DAY
To Fetch coming one month data event
SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') > CURDATE() AND STR_TO_DATE(event_start_time, '%d-%m-%Y') <= CURDATE() + INTERVAL 30 DAY
To fetch Today’s Event
SELECT * FROM event WHERE STR_TO_DATE(event_start_time, '%d-%m-%Y') = CURDATE()