How to get days and hours from diffForHumans with Carbon?

I want to show the number of days and hours to a date using Carbon , currently I have received the code below.

 Carbon::parse("2017-03-07 17:46:50")->diffForHumans() 

It outputs:

After 6 days

I want it to output something like this:

6 days and after 12 hours

How can i do this?

+5
source share
1 answer

Sorry, I got this question today, but here it is

 $now = Carbon::now(); Carbon::parse("2017-03-07 17:46:50")->diffForHumans($now); 

I hope this works and can help others.

0
source

Source: https://habr.com/ru/post/1264853/


All Articles