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.

Answers


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.

SELECT STR_TO_DATE('21/5/2013','%d/%m/%Y');

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') ;

Try this:

SELECT ... FROM ... WHERE STR_TO_DATE(col, '%d/%m/%Y') > NOW()

Need Your Help

decodeHexString obj-c implementation, Should I support odd lengthed hexstrings, and if so, how?

objective-c cocoa nsstring hex

I may be missing something in the standard libs, but I don't think so. I have this current implementation: