Hi all, is it possible to format the way now() enters the format of the date and time into the database. It's going in as 2011-01-31 11:03. I want it to ideally be 31-01-2011 11:03. Any help is appreciated as always![]()
| SitePoint Sponsor |



Hi all, is it possible to format the way now() enters the format of the date and time into the database. It's going in as 2011-01-31 11:03. I want it to ideally be 31-01-2011 11:03. Any help is appreciated as always![]()
In doesn't enter that way in the database at all. It's just the way the database shows the value to you.
You can change the way it is presented to you using date_format
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget



Hi guido, I've just tried formatting the date as my below example but now nothing is showing...?
PHP Code:<?php echo date_format($orders['date_added'],'%b %d %Y %h:%i %p') ?>
date_format is a MySQL function...
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget



Right ok, so I need to use that function when entering data to the database?



Hey dude, could you possibly show me an example of how this is done? Cheers![]()
As posted above: http://dev.mysql.com/doc/refman/5.1/...on_date-formatCode:SELECT data_format( DateField, ... ) FROM testtable



Massive help thanks, is there any I can incorporate this into a SELECT * FROM table as this is what I have used. Though I don't think that's best practice?
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget



Okey dokeyThank you both for your help and advice.
Bookmarks