我在app.php中将时区更改为“亚洲/加尔各答”
Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Asia/Kolkata',`
现在我尝试计算两个时间之间的比输出给出+5:30时间
如何解决此问题?
例子:-
$inTime = "10:08:00";
$outTime = "10:08:00";
$spentTime = strtotime($outTime) - strtotime($inTime);
echo "<pre>";
print_r("out time = ".$outTime);
echo "<br>";
print_r("in time = ".$inTime);
echo "<br>";
print_r("spent time = ".$spentTime);
$spentTime = **date('H:i:s', $spentTime)**;
echo "<br>";
print_r("spent time format = ".$spentTime);
die;
输出:-
out time = 10:08:00
in time = 10:08:00
spent time = 0
spent time format = 05:30:00
我期望"花费时间格式"给定= 00:00:00
我们可以做些什么来实现这一目标?
谢谢你!
1条答案
按热度按时间pes8fvy91#
试着在你的项目中使用碳。