Need to display date and day based records in php and mysql


actually i am trying to achieve day and date based records from mysql, for more information check the screenshot attached below. can any one help me ?

SELECT
    bb.name,
    c.fullname AS course_name,
    bb.*,
    bb.id,
    FROM_UNIXTIME(bb.openingtime) as openingtimeD 
FROM
    mdl_user u
JOIN mdl_role_assignments ra ON
    u.id = ra.userid
JOIN mdl_role r ON
    ra.roleid = r.id
JOIN mdl_context ctx ON
    ra.contextid = ctx.id AND ctx.contextlevel = 50
JOIN mdl_course c ON
    ctx.instanceid = c.id
JOIN mdl_bigbluebuttonbn bb ON
    c.id = bb.course
WHERE
    u.id = 161

Above is my query and my php code is like the below:

foreach ($bbb_sql as $bbb_key => $bbb_value) {
        $dayName = date('l',strtotime($bbb_value->openingtimed));
        if($dayName == "Monday"){

        }
        if($dayName == "Tuesday"){

        }
        if($dayName == "Wednesday"){

        }
        if($dayName == "Thursday"){

        }
        if($dayName == "Friday"){

        }
        if($dayName == "Saturday"){

        }
    }

But i get it like this,enter image description here

(enter image description here)(2)

But the output i need it like the below,

Monday-13-06-2020

Maths, Science, English

Tuesday-14-06-2020

Science, Maths

Friday-17-06-2020

English, Social Science

Monday-20-06-2020

Science, Maths
(2): https://i.stack.imgur.com/c0xql.png