[英]How to put the current datetime in MySQL using PHP
How to put the current datetime in MySQL using PHP? 如何使用PHP在MySQL中放置当前日期时间?
The result should be: 结果应为:
mysql_query("INSERT INTO users (r_date) VALUES ('the current datetime')");
The type of r_date
is datetime
. r_date
的类型为datetime
。
如果您的字段是DATE或DATETIME,则NOW()
将起作用:
INSERT INTO users (r_date) VALUES (NOW());");
Note that the now() function insert current date of MySQL server. 注意now()函数插入MySQL服务器的当前日期。 If you need to insert server date you should use php date function
如果您需要插入服务器日期,则应使用php date函数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.