Are you using the query builder instead of Eloquent or how are you getting the data?
Anyhow, you could always parse a string date..
\Carbon\Carbon::parse($quotation[0]->created_at)->format('d/m/Y');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have been Googling and trying different recomentations here on Laracasts but without success. Essentially, Carbon formating needs to see an object, but my data is coming off the DB as an array:
array:1 [▼
0 => {#340 ▼
+"reference": "Joh170117-61"
+"quote_name": ""
+"lead_product": ""
+"total": "134.34"
+"job_address": ""
+"job_city": ""
+"start_date": "Tue Feb 21"
+"created_at": "2017-01-17 16:22:44"
+"company_name": "Private Sale"
+"firstname1": "Jill"
+"lastname1": "Johness"
+"telephone1": "4036853105"
+"address": "151 Auburn Place"
}
]
so when it reaches my view the data looks like this:
{{date_format($quotation[0]->created_at}}
So it is presented as 2017-01-17 15:03:22
So what can I do to get the created_at date reformated into d/m/Y in Blade ?
Many thank !
Are you using the query builder instead of Eloquent or how are you getting the data?
Anyhow, you could always parse a string date..
\Carbon\Carbon::parse($quotation[0]->created_at)->format('d/m/Y');
Please or to participate in this conversation.