开发者

How to put the current datetime in MySQL using PHP

How to put the current dateti开发者_如何学Pythonme in MySQL using PHP?

The result should be:

mysql_query("INSERT INTO users (r_date) VALUES ('the current datetime')");

The type of r_date is datetime.


If your field is a DATE or DATETIME, NOW() will work:

INSERT INTO users (r_date) VALUES (NOW());");


Note that the now() function insert current date of MySQL server. If you need to insert server date you should use php date function

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜