PHP Carbon不计算时差
我需要得到时差。但是碳不计算。
date1 2022-03-30 00:00:00
date2 2022-03-30 21:00:00
$interval = $date1->diffInSeconds($date2); -> OUTPUT: 0
$interval2 = $date1->diffAsCarbonInterval($date2); -> OUTPUT:
I need to get the time difference.But carbon does not calculate.
date1 2022-03-30 00:00:00
date2 2022-03-30 21:00:00
$interval = $date1->diffInSeconds($date2); -> OUTPUT: 0
$interval2 = $date1->diffAsCarbonInterval($date2); -> OUTPUT:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你应该用Carbon解析所有数据并将其转换为Carbon实例,然后你就可以得到差异
You should parse all the data with Carbon to convert it to Carbon instance, then you can get the difference