Page 1 of 1

date problem?

Posted: Fri Mar 05, 2010 7:15 am
by adilmarwat2004
I am using mysql and want to know about the mysql Dare datatyep.

I have enter the data as 05-03-2010.

on display it shows it as 2010-03-05.

I want to set the mysql as 05-03-2010 forever when i display the date.

please help.

Adil

Re: date problem?

Posted: Mon Mar 22, 2010 4:47 pm
by lshaw
This is not a problem with mysql DATE, its just how dates are stored. You format the date each time it is fetched from the database with the DATE_FORMAT(date,format) function
http://dev.mysql.com/doc/refman/5.1/en/ ... ate-format

Example:

Code: Select all

SELECT DATE_FORMAT(date, '%d-$c-%Y %M %Y') AS date,other_column FROM tbl_name