STR_TO_DATE(t.datestring, '%d/%m/%Y')
...will convert the string into a datetime datatype. To be sure that it comes out in the format you desire, use DATE_FORMAT:
DATE_FORMAT(STR_TO_DATE(t.datestring, '%d/%m/%Y'), '%Y-%m-%d')
If you can't change the datatype on the original column, I suggest creating a view that uses the
STR_TO_DATE
call to convert the string to a DateTime data type.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.