I\'m having problems getting the date inserted properly into my database.
$date = date(\'m/d/Y h:i:s\', time());
I use this format, and, it
set the type
of column named dateposted
as DATETIME
and run the following query:
INSERT INTO table (`dateposted`) VALUES (CURRENT_TIMESTAMP)
$date = date('Y-m-d H:i:s'); with the type: 'datetime' worked very good for me as i wanted to print whole date and timestamp..
$date = date('Y-m-d H:i:s'); $stmtc->bindParam(2,$date);
I believe, you need to change your code little bit like follows alongside with your database filed type.
mysql_query("INSERT INTO table (`dateposted`) VALUES ($datetime)");
Hope, will work perfectly.