Can i insert date in mySQL in “DD-Mon-YY” format"?

前端 未结 2 1884
陌清茗
陌清茗 2021-01-27 17:14

Mysql support this format YYYY-MM-DD by default. But what if i want to insert date in this format \"dd-Mon-yyyy\" in mysql?? Is there any way so that i can insert the manual dat

相关标签:
2条回答
  • 2021-01-27 17:24

    Try This Format:-

    SELECT DATE_FORMAT(NOW(),'%d-%b-%Y')
    

    This will result as:-

    10-Sep-2014

    Hope this will helpful to you.

    0 讨论(0)
  • 2021-01-27 17:36

    Yes using MySql STRING_TO_DATE() function

    insert into your_table(date_column) values(STR_TO_DATE("09-Sep-2014","%d-%b-%Y"));
    

    SQL FIDDLE DEMO

    0 讨论(0)
提交回复
热议问题