Neal wrote:
I have a MySQL table with a datetime field that stamps the time the
user submitted the form. It works and looks like this:
$sql = "INSERT INTO table
VALUES(....now())";
On another php page to view results, the code:
printf("<br><td> %s</td>\n",
$newArray["datetime"]);
makes it looks like: 2005-02-15 14:44:51
I want it to look like:
Wednesday 15th of January 2005 05:51:38 AM
but when I try "date("l dS of F Y h:i:s A");" I get the format, but
with the CURRENT time. I can't get the time stamped in that format.
Of course you get the current time. You need to pass a timestamp to the
date() function to get a spefic date and time like so:
date("l dS of F Y h:i:s A", strtotime($newArray["datetime"]));
The strtotime() function converts the mysql datetime into a timestamp
suitable for passing to date().
or else format the date and time directly in your query with the MySQL
function DATE_FORMAT. More info about this here:
http://dev.mysql.com/doc/mysql/en/Da...s.html#IDX1385
And there's also this article I wrote:
http://www.electrictoolbox.com/artic...te-time-mysql/
--
Chris Hope - The Electric Toolbox -
http://www.electrictoolbox.com/