想要显示日期计数器

Want to show date counter

我想在下面的代码中制作日期计数器。格式必须是

today's date - previous date

。我尝试添加,但我认为格式不对。你们可以检查一下吗?下面添加截图。

if (mysqli_num_rows($result) > 0) {
                $row = mysqli_fetch_array($result);
                $curr_dt = DateTime::createFromFormat("Y-m-d H:i:s", date("Y-m-d") . " 00:00:00");

                $row_dt = DateTime::createFromFormat("Y-m-d H:i:s", $row["dt_corr"]);

                $color = $row_dt < $curr_dt ? 'red' : 'lime';
        
                $date = "<br><font  style='color: $color; font-size:12px'>".date("d/m/Y",strtotime($row["dt_corr"]))."</font >";
                
                $currentdate = date('Y-m-d H:i:s');
                $after1yrdate =  date("Y-m-d H:i:s", strtotime("+1 year", strtotime($row["dt_corr"])));

                $diff = (strtotime($after1yrdate) - strtotime($currentdate)) / (60 * 60 * 24);

                echo "<p style='color:red'>The difference is ".round($diff)." Days</p>";

            }
            /*if (mysqli_num_rows($result) > 0) {
                $row = mysqli_fetch_array($result);
                $date = "<br><font size=\"2px\" color=\"green\">".$row["dt_corr"]."</font>";
                
                //echo $date.'<br>';
            }*/
            else{
                $date = "";
            }

$currentdate = date('Y-m-d H:i:s');
$previousdate =  date("Y-m-d H:i:s", strtotime($row["dt_corr"]));

$diff = (strtotime($currentdate)-strtotime($previousdate)) / (60 * 60 * 24);

echo "<p style='color: $color; font-size:12px'>".round($diff)." days </p>";