通过比较当前时间和给定时间,将日期增加1天


Increment the date by 1 day by comparing the current time and given time

我想通过比较两次来将日期增加1天。

我的代码:

   <?php 
    if(date("h:i a") > $query2['endtime'])
    {
      $date = new DateTime($date);
      $date->modify('+1 day');
      echo $date->format('Y-m-d');
       echo '<input type="date" name="date" id="date" min="'.date("Y-m-d").'">';
    }
    else
    {
       echo '<input type="date" name="date" id="date" min="'.date("Y-m-d").'">';
    }
    ?>

我想比较当前时间和用户给出的时间。我已经获取了用户给出的时间,像这样的$query2['endtime']。但是,它显示了错误。

请检查我的代码和帮助。

更改引号并添加'。'连接字符串

 echo  "<input type="date" name="date" id="date" min="echo date("Y-m-d"); ">";

:

 echo  '<input type="date" name="date" id="date" min="' . date("Y-m-d") . '">';