[英]Increment the date by 1 day by comparing the current time and given time
I want to increment the date by 1 day by comparing two times.我想通过比较两次将日期增加 1 天。
This is my code:这是我的代码:
<?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").'">';
}
?>
I want to compare the current time by the time given by the user.我想通过用户给出的时间来比较当前时间。 I have fetched the time given by the user like this $query2['endtime']
.我已经获取了用户给出的时间,例如$query2['endtime']
。 But, it is showing me the error.但是,它向我展示了错误。
Please check my code and help.请检查我的代码和帮助。
Any help is much appreciated.任何帮助深表感谢。
change quotes and add '.'更改引号并添加 '.' to join strings连接字符串
echo "<input type="date" name="date" id="date" min="echo date("Y-m-d"); ">";
to:到:
echo '<input type="date" name="date" id="date" min="' . date("Y-m-d") . '">';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.