我有当前时间的unix时间戳。我想获取第二天开始时的unix时间戳。
$current_timestamp = time();
$allowable_start_date = strtotime('+1 day', $current_timestamp);
正如我现在所做的,我只是在unix时间戳上加了整整一整天,而我想要计算出这一天还剩多少秒,并且只需要添加这些秒就可以得到第二天第一分钟的unix时间戳。
做这件事最好的方法是什么?
发布于 2010-03-26 16:04:15
您可以使用以下命令轻松获取午夜时间戳中的明天:
$tomorrow_timestamp = strtotime('tomorrow');
如果你想做一个可变的天数,你可以像这样轻松地做到这一点:
$days = 4;
$x_num_days_timestamp = strtotime(date('m/d/Y', strtotime("+$days days"))));
发布于 2010-03-26 08:26:51
$tomorrow = strtotime('+1 day', strtotime(date('Y-m-d')));
$secondsLeftToday = time() - $tomorrow;
发布于 2010-03-26 08:26:21
一些简单的东西,比如:
$nextday = $current_timestamp + 86400 - ($current_timestamp % 86400);
就是我会用的。
https://stackoverflow.com/questions/2520404
复制相似问题