Hey guys,
I have this line to query my database:
[code=php]putenv(“TZ=US/Eastern”);
$mySqlDateTime= date(“Y-m-d h:i:s”, time());
// insert values into db
mysql_query(“INSERT INTO messages (name, title, message, postdate) VALUES (‘$_POST[aName]’, ‘$_POST[aTitle]’, ‘$_POST[aMessage]’, ‘$mySqlDateTime’)”);
// and later query results from db
$result = mysql_query(“SELECT id, name, title, message, DATE_FORMAT(`postdate`, ‘%m-%d-%Y at %h:%i:%s’) AS datenow FROM messages ORDER BY id Desc”);
So when I do:
[code=php]<?php echo $row[‘datenow’]; ?>
The result is something like: 02-25-2009 at 04:39:39
I’d like the time to read [B]4:39:39pm[COLOR=”Red”]%g[COLOR=”Red”]%a
I guess the FORMAT_DATE doesn’t work with time formatting? I’m lost and can’t figure out any way to make this work correctly.
Does anyone have any idea how I can do this?
Thanks a lot!
-Dan