开发者

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';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜