I am trying to display the created_at column in one of my views and I have no luck. When I try to use below:
{{ date('d MY - H:i:s', $object->created_at) }}
I get the following error: date () expects parameter 2 to be a long, given object. So I use dd () on $ object-> created_at, and this gives me the following:
object(Carbon\Carbon)#555 (3) { ["date"]=> string(26) "2015-01-22 14:36:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(19) "Africa/Johannesburg" }
So naturally, I tried to access the date with a foreach loop that didn't work, and I also tried the date $ object-> created_at->, which gave me the error "Unknown getter 'date" How to access the date from created_at?
laravel laravel-4 php-carbon
David ross
source share