如何从几秒钟的时间中减去几秒钟?

问题描述 投票:0回答:1

从类似时间:

$time_on_seconds = 18000;

等于5个小时。

现在使用此代码减去秒Im:

$new_time_on_seconds = date("H:i", strtotime($time_on_seconds) - 60);

[应该返回我23:59时返回我4:59

php strtotime
1个回答
0
投票

只需删除strtotime。Strtotime会按照名称所说的做一个str(字符串)并使其成为时间(秒),因此在已经存在的数字上使用它是行不通的。

© www.soinside.com 2019 - 2024. All rights reserved.