I get wrong date from MongoDB using Eloquent in Laravel. My record in database looks like this
"created_at" : ISODate("2020-11-17T15:30:42.131+01:00")
Code to get records from MongoDB
$taskObj = TaskComments::where('task_id', $task_id)->get()->toArray();
Result date for created_at is
1970-01-25 20:31:23 which is wrong, I would like to get in this format 2020-11-17 15:30:42
I would like to create correct Mutator or to define a default date format in Laravel or in MongoDb I am not sure.
Any help is appreciated.
This is fixed my problem, I used a mutator in Model of TaskComments