How to display diffrence only by days.
Here $price->created_at = 2014-04-28
CarbonCarbon::createFromTimeStamp(strtotime($price->created_at))->diffForHumans()
Thanks!
See Question&Answers more detail:osHow to display diffrence only by days.
Here $price->created_at = 2014-04-28
CarbonCarbon::createFromTimeStamp(strtotime($price->created_at))->diffForHumans()
Thanks!
See Question&Answers more detail:osSuppose you want difference to now() and result from diffForHumans suits you except for today:
$created = new Carbon($price->created_at);
$now = Carbon::now();
$difference = ($created->diff($now)->days < 1)
? 'today'
: $created->diffForHumans($now);
edit: no need to call Carbon::now() twice so use $now instead.