MySQL DATE_FORMAT '%M' for short month?

27,790
DATE_FORMAT(date, '%d-%b-%y') AS Displaydate
Share:
27,790

Related videos on Youtube

user2574794
Author by

user2574794

Updated on October 24, 2022

Comments

  • user2574794
    user2574794 over 1 year

    I'm trying to display dates like this 27-Jul-13. I keep reading that M should give the shorthand month and F the full name. I am using this:

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

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

    Also if I use F it doesn't work at all, it just displays an F where the month should be. What am I doing wrong?

    • sroes
      sroes over 10 years
      DATE_FORMAT(date, '%d-%M-%y') AS Displaydate is probably mysql, not php

Related