Answer by themrflibble for Calculate difference between two dates using...
Carbon means you do not need to mix PHP Datetime and Carbon.Once you have the datetime as a Carbon, simply do this...$comparisonTimeAsCarbon->diffAsCarbonInterval($theOtherTimeAsCarbon)You can...
View ArticleAnswer by my bytecode for Calculate difference between two dates using Carbon...
Shortest wayWe can directly write it in blade<span>{{ \Carbon\Carbon::parse( $start_date )->diffInDays( $end_date ) }}</span>
View ArticleAnswer by CodeGuru for Calculate difference between two dates using Carbon...
Blade TemplateA shorter code{{ $diff = Carbon\Carbon::parse($data->last_updated)->diffForHumans() }}Result : 6 minutes ago
View ArticleAnswer by Stephen S for Calculate difference between two dates using Carbon...
You code can be cleaned up and have the commented out code removed by doing:<td>{{ $diff = Carbon\Carbon::parse($work['date'])->diffForHumans(Carbon\Carbon::now()) }} </td>
View ArticleAnswer by iivannov for Calculate difference between two dates using Carbon...
You are not following the example from the Carbon Documentation. The method Carbon::createFromDate() expects 4 parameters: year, month, day and timezone. And you are trying to pass a formatted date...
View ArticleCalculate difference between two dates using Carbon and Blade
Does anyone know how to pass a given variable instead the Carbon's default parameters ?The documentation of Carbon says:// CARBON SAMPLE$dtToronto = Carbon::createFromDate(2012, 1, 1,...
View ArticleAnswer by Erich García for Calculate difference between two dates using...
You can use on a Blade template directly:{{ (Carbon\Carbon::parse(Auth::user()->created_at))->diffInDays(Carbon\Carbon::now()) }}
View Article
More Pages to Explore .....