Re: [PHP] mysql DATE_FORMAT() question

2007-12-12 Thread Adam Williams

nevermind, I see I had a mistake in my mysql statement,  I should of been:

select DATE_FORMAT(testdate, '%m\-%d\-%Y') as date_column from testtable;

please disregard.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] mysql DATE_FORMAT() question

2007-12-12 Thread Adam Williams

I ran the commands:

CREATE TABLE testtable ( testdate DATETIME);

INSERT INTO testtable (testdate) VALUES (now());

and then I want to select it but format it to show the date only (not 
the time, and yes I know I could use DATE instead of DATETIME, but there 
may be cases where I need to show the time also).  So I run:


select DATE_FORMAT(testdate, '%m\-%d\-%Y') from testtable AS date_column;
+-+
| DATE_FORMAT(testdate, '%m\-%d\-%Y') |
+-+
| 12-12-2007  |
+-+


now my question is, why is the column heading DATE_FORMAT(testdate, 
'%m\-%d\-%Y') even though I told it to be called date_column?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php