mercredi 9 février 2022

Sort JSON response by date in laravel 5.5

So far I noticed, It is sorting with the first character of the date

My Code

$data = json_decode($json);  
$collection = new Collection($data);
$collection->sortByDesc('CreationDate')

My JSON

"[{"NumberCase":"CCS - 102957","CreationDate":"03/12/2019 16:59:19","ServiceName":"Televisión por Cable","ClientReport":"No ve algunos canales","StatusCode":"Activo"},{"NumberCase":"CCS - 107539","CreationDate":"23/12/2019 16:49:36","ServiceName":"Televisión por Cable","ClientReport":"No ve ningun canal","StatusCode":"Activo"},{"NumberCase":"CCS - 110407","CreationDate":"10/01/2020 16:58:42","ServiceName":"Televisión por Cable","ClientReport":"Baja calidad de imágen","StatusCode":"Activo"},{"NumberCase":"CCS - 115482","CreationDate":"04/02/2020 18:55:24","ServiceName":"Televisión por Cable","ClientReport":"No ve ningun canal","StatusCode":"Activo"},{"NumberCase":"CCS - 118120","CreationDate":"17/02/2020 13:36:58","ServiceName":"Televisión por Cable","ClientReport":"No ve ningun canal","StatusCode":"Activo"},{"NumberCase":"CCS - 189126","CreationDate":"18/08/2021 21:03:10","ServiceName":"Televisión por Cable","ClientReport":"No ve ningun canal","StatusCode":"Activo"},{"NumberCase":"CCS - 189870","CreationDate":"23/08/2021 16:41:50","ServiceName":"Televisión por Cable","ClientReport":"No ve algunos canales","StatusCode":"Resuelto"},{"NumberCase":"CCS - 82862","CreationDate":"09/09/2019 20:47:16","ServiceName":"Televisión por Cable","ClientReport":"No ve ningun canal","StatusCode":"Activo"},{"NumberCase":"CCS - 85805","CreationDate":"19/09/2019 20:35:24","ServiceName":"Televisión por Cable","ClientReport":"Se congela la imagén y salen cuadros en toda la pantalla","StatusCode":"Activo"}]"


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/5vJ2omz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire