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

前端 未结 2 1915
陌清茗
陌清茗 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: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

提交回复
热议问题