SQL Varchar to milliseconds
I have a column in my MySql database which stores a date as a string "dd/mm/yyyy" is there a way for me to have this in an update query where I can check if the date in the table is overdue compared to now().
I've had a look at the CONVERT function but can't figure out how to use it for my case.
STR_TO_DATE() converts the str string into a date value based on the fmt format string. The STR_TO_DATE() function may return a DATE , TIME, or DATETIME value based on the input and format strings. If the input string is illegal, the STR_TO_DATE() function returns NULL.
With time :-
SELECT STR_TO_DATE('01/01/2013 1130','%d/%m/%Y %h%i') ;
compare with now()
Where now()=STR_TO_DATE('01/01/2013 1130','%d/%m/%Y %h%i') ;
SELECT ... FROM ... WHERE STR_TO_DATE(col, '%d/%m/%Y') > NOW()