简体   繁体   English

PHP mySQL时间戳需要返回日期为00:00:00

[英]PHP mySQL timestamp need return date as 00:00:00

I want to get time from TIMESTAMP using php in mySQL 我想在mySQL中使用php从TIMESTAMP获取时间

while ($row = mysql_fetch_array($result)) {
     $detail["work_time"] = date("H-i-s", strtotime($row["entry_time"]));
}

The value of row entry_time is 00:00:00 00:00:00 but when I print $detail["work_time"] the result is 01:00:00 . 排entry_time的值是00:00:00 00:00:00但是当我打印$detail["work_time"]的结果是01:00:00 I need the 00:00:00 result. 我需要00:00:00结果。 Any help is appreciated. 任何帮助表示赞赏。

You can't do it. 你不能这样做。 If you have strtotime() , you have to put valid string, which is the number of seconds since January 1 1970 00:00:00 UTC. 如果你有strtotime() ,你必须输入有效的字符串,这是自1970年1月1日00:00:00 UTC以来的秒数。

The minimum date is January 1 1970 00:00:00 UTC . 最短日期是January 1 1970 00:00:00 UTC If your timezone is +1, the full time will be January 1 1970 01:00:00 UTC by default. 如果您的时区为+1,则默认情况下,全职时间为January 1 1970 01:00:00 UTC You can check it: just put dmY before His . 你可以检查一下:把dmY放在His面前。

You should refactor your logic. 你应该重构你的逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM