当我尝试编辑表单中的某些字段时,日期被重置为 01-01-1970 01:00:00 但它第一次完美地从数据库中存储和检索其值。然后,当我编辑除日期以外的其他字段时,它会被重置。
在我的 jQuery 日期选择器下方:
<script>
$(document).ready(function(){
$("#policy_start_date").datepicker({
numberOfMonths: 1,
onSelect: function(selected) {
$("#policy_end_date").datepicker("option","minDate", selected)
}
});
$("#policy_end_date").datepicker({
numberOfMonths: 1,
onSelect: function(selected) {
$("#policy_start_date").datepicker("option","maxDate", selected)
}
});
});
</script>
发布数据
$date_t=$_POST['policy_start_date'];
$datearr=explode('/',$date_t);
$month=$datearr[0];
$day=$datearr[1];
$year=$datearr[2];
$policy_start_date=$year."-".$month."-".$day;
//$policy_end_date = $_POST['policy_end_date'];
$date_t=$_POST['policy_end_date'];
$datearr=explode('/',$date_t);
$month=$datearr[0];
$day=$datearr[1];
$year=$datearr[2];
$policy_end_date=$year."-".$month."-".$day;