📜  laravel 8 刀片在几天和几小时前得到 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:51.395000             🧑  作者: Mango

代码示例1
@php($diffInDays = \Carbon\Carbon::parse($user->created_at)->diffInDays())

@php($showDiff = \Carbon\Carbon::parse($user->created_at)->diffForHumans())

@if($diffInDays > 0)

@php($showDiff .= ', '.\Carbon\Carbon::parse($user->created_at)->addDays($diffInDays)->diffInHours().' Hours')

@endif

{{$showDiff}}