is there a cast in the relevant model? what version of laravel are you using because in laravel 7 they changed the format: https://laravel.com/docs/7.x/upgrade#date-serialization
that link also shows you what to do to revert the behaviour
Hi guys, im facing a strange behaviour: Im retriving some timestamps stored on my db doing:
$registers = Fichajes::all()->toArray();
$msg="Registros: \n";
foreach($registers as $register){
$msg .= $register['created_at'].' '.$register['type']."\n";
}
return urlencode($msg);
If I look at my Fichajes table , it looks like:
+----+---------------------+---------------------+---------+--------+
| id | created_at | updated_at | user_id | type |
+----+---------------------+---------------------+---------+--------+
| 3 | 2020-03-22 17:49:38 | 2020-03-22 17:49:38 | 7 | begin |
| 4 | 2020-03-22 18:03:03 | 2020-03-22 18:03:03 | 7 | finish |
| 5 | 2020-03-22 18:25:18 | 2020-03-22 18:25:18 | 7 | salida |
+----+---------------------+---------------------+---------+--------+
But when I bring the data , they looks like:
2020-03-22T17:49:38.000000Z begin
2020-03-22T18:03:03.000000Z finish
2020-03-22T18:25:18.000000Z salida
2020-03-22T18:26:21.000000Z salida
2020-03-22T18:26:27.000000Z entrada
How can I avoid those '000000Z' strings on my data ? Regards. Leandro
is there a cast in the relevant model? what version of laravel are you using because in laravel 7 they changed the format: https://laravel.com/docs/7.x/upgrade#date-serialization
that link also shows you what to do to revert the behaviour
Please or to participate in this conversation.