How to group datetime by date?

I have a question, the date is stored in datetime format, I need to do something like this
===2.10.2017===
08:00 the message text
8:20 the message text
===3.10.2017===
14:00 text message
15:00 the message text

Roughly grouped, but the question arose as to group only the day messages?
Comment::find()->groupBy(['date'])->all()
There do I need to translate everything in unix format the date?
June 14th 19 at 20:37
1 answer
June 14th 19 at 20:39
Solution
$items = Comment::find()->addSelect(['DATE(date) as just_date'])->asArray()->all();
$items = ArrayHelper::index($items , null, 'just_date');
Going to ask a stupid question, but how do I output in the foreach, I just leave them as separate arrays - Waylon_Kub commented on June 14th 19 at 20:42
All caught up with the index is the date - Waylon_Kub commented on June 14th 19 at 20:45

Find more questions by tags PHPYii