MySQL -PHP insert DATETIME
can anyone please guide me on How to insert a DATETIME filed from 开发者_如何学Ciphone through PHP script into MySQL database.
$dates = date('Y-m-d H:i:s','2010-10-12 15:09:00');
$query = "INSERT INTO timeTable(time) VALUES ('$dates')";
Thank you..
For date()
function as a second argument you should pass a timestamp.
$dates =date('Y-m-d H:i:s', strtotime('2010-10-12 15:09:00') );
But you have already your time in a good form sou you should just do:
$dates = '2010-10-12 15:09:00';
精彩评论