start date
과 end date
을 비교하려고하지만 같은 달에 작동합니다. 하지만 난 두 달 다른 일을하지 입력하십시오. 예를 들어두 날짜가 맞지 않는 경우
: 나는 그것을 작동합니다 start date= 23/12/2013
및 End date=06/12/2013
입력 모르지만, 나는 Start date = 23/12/2013
과 End date=01/01/2014
이 같은 오류를 줄 것이다 입력입니다.
모델 :
public function _date(){
$startDate = strtotime($this->input->post('start_date'));
$endDate = strtotime($this->input->post('end_date'));
if ($endDate >= $startDate)
return True;
else {
return False;
$this->form_validation->set_message('compareDate', '%s should be greater than Contract Start Date.');
}
return False;
}
컨트롤러 :
function date_validation(){
$isDate = $this->mdl_education->_date();
$data['emp_id'] = $this->input->post('emp_id',TRUE);
if($isDate)
{
$this->session->set_flashdata('msg', 'Please Enter valid Date ');
redirect("education/form/".$data['emp_id']);
}
}
$this->form_validation->set_rules('end_date', 'End Date', 'trim|required|xss_clean|callback_date_validation');
솔루션은 무엇입니까?