southbeach
Programmer
I just stumbled onto a situation where data stored in DB (MySQL) for a date field is set as VARCHAR(10). Dates are stored as mm/dd/YYYY.
Since the new year, queries stopped working (where dates are used). This is, of course, because if you compare literal string 01/01/2009 against 08/20/2008, 01/01/2009 will be of a lesser value thus falling out of date range.
I need a solution to this and I am not sure of a swift and secure solution. These are the options I think I have:
(1) Modify query scripts and do data manipulation outside the MySQL query command
(2) Add date field to table, transfer string date to date field, remove string date field, rename date field
(3) Use available functions to do the work for me strtotime() (or something like that) but I am not sure this is an option at all
Any thoughts?
Thank you all in advance for your assistance.
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
Since the new year, queries stopped working (where dates are used). This is, of course, because if you compare literal string 01/01/2009 against 08/20/2008, 01/01/2009 will be of a lesser value thus falling out of date range.
I need a solution to this and I am not sure of a swift and secure solution. These are the options I think I have:
(1) Modify query scripts and do data manipulation outside the MySQL query command
(2) Add date field to table, transfer string date to date field, remove string date field, rename date field
(3) Use available functions to do the work for me strtotime() (or something like that) but I am not sure this is an option at all
Any thoughts?
Thank you all in advance for your assistance.
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.