我有这个问题,我使用的是 cake 2.8.x,我的 cakephp 应用程序没有保存日期字段的选定值。即使您选择了 "2016-02-02" ,它也会一直保存 "1970-01-01" 。有什么问题?
这是我在控制器中的代码
$this->request->data['Jobapp']['dayofbirth']= date('Y-m-d H:i:s', strtotime($this->request->data['Jobapp']['dayofbirth']));
$this->request->data['Jobapp']['dateofissue']= date('Y-m-d H:i:s', strtotime($this->request->data['Jobapp']['dateofissue']));
$this->request->data['Jobapp']['expirydate']= date('Y-m-d H:i:s', strtotime($this->request->data['Jobapp']['expirydate']));
这是视图文件中的字段之一
<td><?php echo $this->Form->input('dayofbirth',array('label'=>'Date of Birth','type'=>'date','minYear'=>date('Y') - 90))?>
可能是什么问题?
'dayofbirth' => array(
'day' => '12',
'month' => '08',
'year' => '1993'
),
'maritalstatus' => 'emtpy',
'nationality' => 'empty',
'complexion' => '',
'passportnumber' => '',
'dateofissue' => array(
'month' => '05',
'day' => '25',
'year' => '2016'
),
'placeofissue' => '',
'expirydate' => array(
'month' => '05',
'day' => '25',
'year' => '2016'
),