[英]Finding difference in PHP timestamp?
I have a timestamp like this, I'm trying to calculate how long between created_at and closed_at, so how long the session lasted. 我有这样的时间戳,我试图计算created_at和closed_at之间的时间,因此会话持续了多长时间。
{{ Carbon\Carbon::parse($clientLogin->closed_at - $clientLogin->created_at)->diffForHumans() }}
Although it wont let me compare it? 虽然它不会让我比较它?
Object of class Illuminate\\Support\\Carbon could not be converted to int (View: C:\\Users\\admin\\Desktop\\workspace\\document_root\\resources\\views\\user\\logs.blade.php) 无法将Illuminate \\ Support \\ Carbon类的对象转换为int(视图:C:\\ Users \\ admin \\ Desktop \\ workspace \\ document_root \\ resources \\ views \\ user \\ logs.blade.php)
试试下面的代码:
Carbon\Carbon::parse($clientLogin->getOriginal('closed_at'))->diffForHumans(Carbon::parse($clientLogin->getOriginal('created_at')), true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.