Php 在Laravel视图上减去时间

Php 在Laravel视图上减去时间,php,mysql,laravel,views,strtotime,Php,Mysql,Laravel,Views,Strtotime,这是我的代码 @foreach($myquery as $mydate) <tr> <td>{{date('l',strtotime($mydate->logon))}}</td> <td>{{date('jS F, Y',strtotime($mydate->logon))}}</td> <td>{{date('h:i A',strtotime($

这是我的代码

    @foreach($myquery as $mydate)
    <tr>
        <td>{{date('l',strtotime($mydate->logon))}}</td>
        <td>{{date('jS F, Y',strtotime($mydate->logon))}}</td>
        <td>{{date('h:i A',strtotime($mydate->logon))}}</td>
        <td>{{date('h:i A',strtotime($mydate->logoff))}}</td>
        <td>{{$mydate->logon->diff($mydate->logoff)}}</td>
    </tr>
    @endforeach
@foreach($myquery作为$mydate)
{{date('l',strottime($mydate->logon))}
{{date('jsf,Y',strotime($mydate->logon))}
{{date('h:ia',strottime($mydate->logon))}
{{date('h:ia',strottime($mydate->logoff))}
{{$mydate->logon->diff($mydate->logoff)}
@endforeach

我想做的是得到登录和注销的区别。我刚刚收到了错误500,请帮助我的错误,我忘记了日期还没有转换成字符串来减去它

    @foreach($myquery as $mydate)
    <tr>
        <td>{{date('l',strtotime($mydate->logon))}}</td>
        <td>{{date('jS F, Y',strtotime($mydate->logon))}}</td>
        <td>{{$date1=date('h:i A',strtotime($mydate->logon))}}</td>
        <td>{{$date2=date('h:i A',strtotime($mydate->logoff))}}</td>
        <td>{{$date2-$date1}}</td>
    </tr>
    @endforeach
@foreach($myquery作为$mydate)
{{date('l',strottime($mydate->logon))}
{{date('jsf,Y',strotime($mydate->logon))}
{{$date1=date('h:ia',strottime($mydate->logon))}
{{$date2=date('h:ia',strottime($mydate->logoff))}
{{$date2-$date1}
@endforeach

请转到你的
app/config/app.php
并将
debug
更改为
true
,然后用实际的错误消息更新你的问题。它已设置为true sir那么错误消息是什么?没有它,很难知道发生了什么。对不起,但这就是我刚刚得到的,哦,出了点问题!错误代码:500I找到答案,数据库中的mydate尚未转换为字符串在这种情况下,我将回答我的问题再次遇到问题,我得到了否定的结果