date problem?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

date problem?

Post 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
lshaw
Forum Commoner
Posts: 69
Joined: Mon Apr 20, 2009 3:40 pm
Location: United Kingdom

Re: date problem?

Post 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
Post Reply