I have populated a combo box with months from my database on MySQL. The problem is that the months are displayed as numbers (because of the default format). I want to display it as the full names of the months and in order. I have tried using DATENAME
, TO_CHAR
and DATE_FORMAT
functions but my MySQL displays this error for each:
Error Code: 1305. FUNCTION sales.DATENAME does not exist
How can I change the following Java code so that the month names are displayed and in the correct order?
Java code for calling the months from MySQL:
String sql = "SELECT DISTINCT EXTRACT(MONTH FROM syear) AS monthSales from dbsales";