Now() Format

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 :smiley:

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

Hi guido, I’ve just tried formatting the date as my below example but now nothing is showing…?

<?php echo date_format($orders['date_added'],'%b %d %Y %h:%i %p') ?>

date_format is a MySQL function…

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

No, when you pull it out of the database.

Hey dude, could you possibly show me an example of how this is done? Cheers :slight_smile:


SELECT data_format( DateField, ... ) FROM testtable

As posted above: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

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?

Don’t use the * :slight_smile:

Okey dokey :slight_smile: Thank you both for your help and advice.