[SOLVED] PHP – Get info from api T00000 AS DATE should not be there

Issue

hello I want to remove this T00:00:00 from the Date.
Start Date: 2022-03-25T00:00:00

        foreach ($data as $key => $value) {
        $startDate=   $value['startDate']
        echo "<li><h5>Start Date: $startDate</h5></li>"; 

Solution

You can split by character ‘T’ and take the first part of it.

foreach ($data as $key => $value) {
    $startDate = explode("T", $value['startDate'])[0];

Answered By – Tsetsentsengel Munkhbayar

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *