I'm a bit confused how to use this function. Found this and tried to follow but I've got some wired result. I've got date from array Date A
[time_utc] => 2016-10-11T19:21:34Z
Then I convert it using date function in php like this
$new_date = date('jS F Y \| h:i: A', strtotime($date));
and new date which I see on the page is 11/10/16 19:21pm
Then I've pulled from my database Date B
which is in timestamp
type and looks like 2016-10-11 19:19:15
and perform same converting
created_at->format('d/m/y G:ia')
which result in same format 11/10/16 19:19pm
Now with carbon I'm trying to see difference from today's date:
<pre>{{ created_at->format('d/m/y G:ia')}} | {{ \Carbon\Carbon::createFromTimeStamp(strtotime($order->created_at))->diffForHumans() }}</pre>
<pre>{{ $new_date ?: "Null" }} | {{ \Carbon\Carbon::createFromTimeStamp(strtotime($new_date))->diffForHumans() }}</pre>
But result is:
11/10/16 19:19pm | 2 days ago
11/10/16 19:21pm | 46 years ago
Why second date which come from array show 46 years ago?