php - mysql 上的日期始终为 1970

标签 php mysql

我想在用户执行某些操作时用当前时间更新我的表,我正在使用这个:

$date = date("Y-m-d", strtotime($date) );
$data_insert = mysqli_query($conn, "UPDATE account.account SET last_vote = '$date' WHERE login = '$account'") or die(mysql_error());

问题是所有内容都返回“1970-01-01”...

最佳答案

PHP strtotime() 函数

The strtotime() function parses an English textual datetime into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 GMT).

http://www.w3schools.com/php/func_date_strtotime.asp

关于php - mysql 上的日期始终为 1970,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30416062/

相关文章:

php - mobiquo.php 是什么?

php - 如何获得注册 token ?

两列的MySQL区别

java - MySQL 异常 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException : Communications link failure

php - mysql 将值从 temp_table 复制到表

php - 保存最后执行的 mysql(i) 语句以便再次执行

php - 在图像下方添加文本,输出取决于输入语言?

php - 没有错误,但代码不起作用

php - 如何将 PHP 中的 MySql 数据放入 Cocoa 应用程序 TableView

php - 如何在列中插入多个出值(value)