[英]PHP Date_format Warning
I have a form with dropdown tags: 我有一个带有下拉标签的表单:
MONTH DAY YEAR HOURS MINS
And when I retrieve the values while submiting the form: 当我在提交表单时检索值时:
$selMonth = htmlentities($_POST['regmonth']);
$selDay = htmlentities($_POST['regday']);
$selYear = htmlentities($_POST['regyear']);
$selHours = htmlentities($_POST['reghours']);
$selMins = htmlentities($_POST['regmins']);
$date = date_create("".$selDay."-".$selMonth."-".$selYear." ".$selHours.":".$selMins."");
$actual_date = date_format($date, 'd-M-Y H:i');
$timestamp = strtotime($actual_date);
//echo $actual_dt.','.$timestamp;
Iam getting the correct date but have a warning always: 我得到的日期正确,但始终会发出警告:
Warning: date_format() expects parameter 1 to be DateTime, boolean given in C:\wamp\www\source\form.php on line 37.
Could anyone suggest why I was getting this warning. 谁能说出我为什么收到这个警告。
$selMonth = htmlentities($_POST['regmonth']);
$selDay = htmlentities($_POST['regday']);
$selYear = htmlentities($_POST['regyear']);
$selHours = htmlentities($_POST['reghours']);
$selMins = htmlentities($_POST['regmins']);
$date = ("".$selYear."-".$selMonth."-".$selDay." ".$selHours.":".$selMins."");
$timestamp = Date("Y-m-d H:i",strtotime($date));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.