noganno
7/14/2017 - 10:47 AM

timestamp ago created_at

timestamp ago created_at

<?
$item->created_at->diffForHumans() ; //3 hours from now


// или
public function getTimeAgo( $created )
{
	$startTime = Carbon::parse($created);
	$finishTime = Carbon::now();

	$totalDuration = $finishTime->diffInSeconds($startTime);
	$time = explode(' ', gmdate('d H', $totalDuration));

	return $time;
}