Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mySQL timestamp need return date as 00:00:00

Tags:

php

mysql

I want to get time from TIMESTAMP using php in mySQL

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. I need the 00:00:00 result. Any help is appreciated.

like image 847
Yulla Avatar asked Jul 12 '26 15:07

Yulla


1 Answers

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.

The minimum date is 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. You can check it: just put d-m-Y before H-i-s.

You should refactor your logic.

like image 188
Kristiyan Avatar answered Jul 14 '26 06:07

Kristiyan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!