php - How To Convert 1 day To Seconds

…衆ロ難τιáo~ 提交于 2019-12-01 05:31:32

You can use strtotime() with a second parameter, like following:

strtotime('1 day 30 second', 0);

This will give you 86430, which is the number of seconds in 1 day and 30 seconds.

(If the second parameter is omitted, the current timestamp (i.e. time()) is used to add what is specified in the string, which leads to the big number.)

Jompper

Try the following code:

$day = 1;
$hour = 1;
$minute = 1;
$second = 0;
$second += (($day * 24 + $hour) * 60 + $minute) * 60;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!