How to assemble the same elements of an array together

there is an array of the first picture below. I want to assemble the same parts of the time Y-m-d together. Is there any other way that I use this way?

clipboard.png

clipboard.png

        $new_data = [];
        foreach ( $data_regiment as $key => $value) {
            $new_data[date("Y-m-d", strtotime($value["created_at"]))][] = $value;
        }

        $this->json(200, "", $data_regiment);
Php
Jun.25,2021

it's a strange requirement. Y-M-D is the same, but the time is different. What is the requirement?

Menu