Level 50
The created_at field is a Carbon instance, so when you are returning your json you can so this:
'created_at' => $model->created_at->format('d/m/Y');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hi all i have data in json formt
[
{"id":4,
"title":"title",
"description":"hi there",
"created_at":"2018-12-11 22:11:01"}
]
i want to change date format to 11/12/2018
how to do that??
this it doesnt work because its in json (string), it doesnt allow me to change it
$json->created_at->format('dd/mm/yyyy');
SO, i use javascript to change the format
Please or to participate in this conversation.