coxdabd — 2011-01-31T06:04:38-05:00 — #1
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
guido2004 — 2011-01-31T06:08:29-05:00 — #2
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
coxdabd — 2011-01-31T06:14:41-05:00 — #3
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') ?>
guido2004 — 2011-01-31T06:15:51-05:00 — #4
date_format is a MySQL function...
coxdabd — 2011-01-31T06:21:41-05:00 — #5
Right ok, so I need to use that function when entering data to the database?
logic_earth — 2011-01-31T06:25:05-05:00 — #6
No, when you pull it out of the database.
coxdabd — 2011-01-31T06:26:26-05:00 — #7
Hey dude, could you possibly show me an example of how this is done? Cheers
logic_earth — 2011-01-31T06:27:45-05:00 — #8
coxdabd — 2011-01-31T06:34:06-05:00 — #9
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?
guido2004 — 2011-01-31T06:43:37-05:00 — #10
Don't use the *
coxdabd — 2011-01-31T06:49:06-05:00 — #11
Okey dokey Thank you both for your help and advice.