Reputation: 4480
I am trying to use diffForHumans with a date that is in string format. I used strtotime to convert the string to Unix Timestamp. The problem is now I am getting an error that cannot covert integer to time. What am I missing?
Here is my code.
<td>{{strtotime($user['scan'])->diffForHumans(time())}}</td>
$user['scan'] is a date that is a string
Upvotes: 1
Views: 255
Reputation: 11906
Use parse. The date is compared to the current time by default.
<td>{{ \Carbon\Carbon::parse($user['scan'])->diffForHumans() }}</td>
Upvotes: 3