這是一個(gè)使問(wèn)題清楚的示例。以下兩個(gè)示例都給出了錯(cuò)誤的區(qū)別:// 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')); 我想要的是23:59:59compared with00:00:01返回 2 秒的差異,和 00:00:01compare with 23:59:59。
如何在 PHP 中計(jì)算 2 次(不是日期時(shí)間)之間的秒差。Laravel // PHP // 碳
料青山看我應(yīng)如是
2022-12-23 15:47:53
