I want to display how many days and hours to a date using Carbon
, currently I got the code below.
Carbon::parse("2017-03-07 17:46:50")->diffForHumans()
It outputs:
6 days from now
I want it to output something like this:
6 days and 12 hours from now
How can I do that?
You can specify the level of details like this:
Carbon::parse("2017-03-07 17:46:50")->diffForHumans(['parts' => 6]);
You can use a value from 1 to 6. (Doc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With