[Solved] Can i insert date in mySQL in “DD-Mon-YY” format”?

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 date in this format.Anyone having any idea??

If possible please write down the insert statement.

Solution #1:

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

Respondent: vikrant singh
Solution #2:

Try This Format:-

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

This will result as:-

10-Sep-2014

Hope this will helpful to you.

Respondent: Ankit Bajpai
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.