Skip navigation links

MySQL Forums :: Database Administration & Monitoring :: change date format in MYSQL


Advanced Search

Re: change date format in MYSQL
Posted by: Erik Cerpnjak ()
Date: February 01, 2009 12:39PM

Mysql has this date format: YYYY-mm-dd. You can change the format mysql stores the date, but it is strongly advised and also easier if you only output your date in a format you preffer:

Example:
Lets say you have a collumn named mydate. then you would write your query like this:

SELECT DATE_FORMAT(mydate, '%d/%m/%Y') as mydate from mytable

The date format from your DB looks like this:
2009-02-01

Mysql will output this date as:
01/02/2009

I hope this helps...

Options: ReplyQuote


Subject Written By Posted
change date format in MYSQL Pradeep Vecha 12/18/2006 02:56AM
Re: change date format in MYSQL Bob Field 12/18/2006 09:34AM
Re: change date format in MYSQL Pradeep Vecha 12/18/2006 11:39PM
Re: change date format in MYSQL Bob Field 12/19/2006 09:56AM
Re: change date format in MYSQL Pradeep Vecha 12/21/2006 02:12AM
Re: change date format in MYSQL Paul Karunakar 02/08/2008 10:53PM
Re: change date format in MYSQL nirav panchal 06/10/2008 12:55AM
Re: change date format in MYSQL Peter Brawley 06/10/2008 02:35PM
Re: change date format in MYSQL Dharma raj 07/28/2007 05:35AM
Re: change date format in MYSQL naveen kumar 08/27/2007 12:50AM
Re: change date format in MYSQL anupam tripathi 07/29/2008 02:09AM
Re: change date format in MYSQL anupam tripathi 07/29/2008 02:05AM
Re: change date format in MYSQL Erik Cerpnjak 02/01/2009 12:39PM
Re: change date format in MYSQL Javedali Shaikh 03/30/2009 01:44AM
Re: change date format in MYSQL Aftab Khan 03/30/2009 02:51AM
Re: change date format in MYSQL larsen mcalister 04/07/2009 02:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.