我的问题:当我结合我的 Jquery datepicker 日历输入和我放在它旁边的下拉菜单来捕获小时、分钟和 AM/PM 时,我无法获得正确的打印日期。
这是我的php代码:
echo protect($_POST['truck_arrive'])." - truck arrive<br>";
echo protect($_POST['truck_arrive_hours'])." - truck arrive hours<br>";
echo protect($_POST['truck_arrive_mins'])." - truck arrive mins<br>";
echo protect($_POST['truck_arrive_ampm'])." - truck arrive ampm<br>";
$truck_arrive_comb = protect($_POST['truck_arrive']).protect($_POST['truck_arrive_hours']).protect($_POST['truck_arrive_mins']).protect($_POST['truck_arrive_ampm']);
echo $truck_arrive_comb." - truck arrive combination<br>";
echo strtotime($truck_arrive_comb)." - truck arrive combination string to time<br>";
echo date("Y-m-d h:i:s",strtotime($truck_arrive_comb))." - truck arrive combination string to time date format<br>";
//$truck_arrive = date("Y-m-d h:i:s",strtotime($truck_arrive_comb));
$truck_arrive = date("Y-m-d h:i:s",strtotime(protect($_POST['truck_arrive'])));
echo $truck_arrive." - truck arrive date format<br>";
它输出这个:
01/16/2013 - truck arrive
01 - truck arrive hours
04 - truck arrive mins
AM - truck arrive ampm
01/16/20130104AM - truck arrive combination
- truck arrive combination string to time
1969-12-31 07:00:00 - truck arrive combination string to time date format
2013-01-16 12:00:00 - truck arrive date format