gpt4 book ai didi

php - mysql 上的日期始终为 1970

转载 作者:行者123 更新时间:2023-11-29 07:36:58 26 4
gpt4 key购买 nike

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

$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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com