lar*_*arb 1 php time laravel difference
下面举一个例子来说明这个问题。下面的两个例子都给出了错误的区别:
// gives 86398 while the correct is 2sec
$diff_in_sec = strtotime('23:59:59') - strtotime('00:00:01');
// again gives 86398 while the correct is 2sec.
$diff_in_sec = Carbon::parse('00:00:01')->diffInSeconds(Carbon::parse('23:59:59'));
Run Code Online (Sandbox Code Playgroud)
我想要的是23:59:59与 相比00:00:01返回 2 秒的差异,并
00:00:01与23:59:59.
| 归档时间: |
|
| 查看次数: |
203 次 |
| 最近记录: |