我怎样才能获得明天00h10的时间戳?

Got*_*bel 5 php time date

为了防止误解:我的所有代码行都很好,并且它们正常工作.我只是在我的错误参数中date()显示秒数date('H:s'),它应该显示分钟数date('H:i').(感谢chumkiu提示.)


我想在00h10获取即将到来的一天的时间戳.

我以为我可以使用这个strtotime()功能,例如

$timestamp = strtotime('tomorrow 00:10');
Run Code Online (Sandbox Code Playgroud)

但是当我检查

$mydate = date('Y-m-d H:s', $timestamp);
var_dump($mydate);
Run Code Online (Sandbox Code Playgroud)

输出是

string(16) "2013-10-03 00:00"
Run Code Online (Sandbox Code Playgroud)

文档中strtotime()有很多例子如何获得不同的时间

echo strtotime("now"), "\n";
echo strtotime("10 September 2000"), "\n";
echo strtotime("+1 day"), "\n";
echo strtotime("+1 week"), "\n";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
Run Code Online (Sandbox Code Playgroud)

但他们都没有接近我的问题.

有趣的是:我能做到这一点

$time_h = strtotime('tomorrow +10 hours');
$time_m = strtotime('tomorrow +10 minutes');
Run Code Online (Sandbox Code Playgroud)

$time_h返回想要的结果(10:00),但$time_m没有.

有任何想法吗?

Luc*_*one 14

只是

echo date("Y-m-d 00:10",strtotime('tomorrow'))
Run Code Online (Sandbox Code Playgroud)

但是在您的代码中,错误是使用H:s而不是H:i

来自doc:

i:带有前导零的分钟| 00至59

s:秒,带前导零| 00到59


kel*_*nik 5

just add 10 minutes:

$timestamp = strtotime('tomorrow +10min');
Run Code Online (Sandbox Code Playgroud)