I have a date column which is in YYYYMMDD or 20120101 format. This is because SAP stores it in this format, so cannot change this.
How can I convert this to a YYYY-MM-DD format in a MySQL query? In DB2, I used a to_date() function.
In MySQL, I’m trying the STR_TO_STRING() function but it returns ‘null’.
SELECT STR_TO_DATE(VBAP.ERDAT,'%Y-%m-%d') FROM VBAP
This works..