Reputation: 1042
I have a table in, MySQL 5.5, having an INT column which is actually a 8-digit number representing a date value in the format YYYYMMDD
How can I convert this column into a DATE type so as for easy compare with other DATE column in other table?
Upvotes: 0
Views: 2267
Reputation: 6661
Use mysql STR_TO_DATE
The STR_TO_DATE() converts the str string into a date value based on the fmt format string.
SELECT STR_TO_DATE('20141012','%Y%m%d') FROM `table`
Upvotes: 2