MySQL DATE_FORMAT '% M' in a short month?

I am trying to show dates like 27-Jul-13 . I keep reading that M should give the abbreviated month and F full name. I use this:

 DATE_FORMAT(date, '%d-%M-%y') AS Displaydate 

but it looks like this: 14-April-12 not 14-Apr-12

Also, if I use F , it does not work at all, it just displays F , where the month should be. What am I doing wrong?

+6
source share
2 answers

According to the DATE_FORMAT doc you need %b for your format:

 DATE_FORMAT(date, '%d-%b-%y') AS Displaydate 
+16
source
 DATE_FORMAT(date, '%d-%b-%y') AS Displaydate 
0
source

Source: https://habr.com/ru/post/950429/


All Articles