PDA

View Full Version : How to Convert date format YYYY-MM-DD as MM-DD-YYYY


leojafree
09-28-2006, 11:40 AM
Hi,

Im trying to insert date in Mysql in the format MM/DD/YYYY. It gets stored in the table as YYYY-MM-DD. Now i need to retrieve back the format as MM-DD-YYYY. Plz help me out....

raf
09-28-2006, 12:55 PM
Wecome here!

in a Mysql date column, you can only store it in the YYYY-MM-DD foremat.
for representation to the end user, you can either use the mysql-function DATE_FORMAT() ( --> http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html ) or use some function of your server side scripting language.

leojafree
10-03-2006, 05:51 AM
Hi Guys,

The following sql query could incorporate the change in date format. It goes
select emp_Id, emp_Name, emp_Desg, date_format(emp_Doj,'%m/%d/%Y') from employee;

Rgds,
Leo