I would like to make a condition where you only display the birthdays of the month. My controller looks like this:
public function index()
{
$ultimoDia = date("t", mktime(0,0,0,date('m'),'01',date('Y')));
$condicoes['order'] = array('Funcionario.NomFun' => 'ASC');
$condicoes['conditions'] = array(
'Funcionario.SitAfa <>' => 7,
'Funcionario.datNasc >=' => date("m").'-01',
'Funcionario.datNasc <=' => date("Y-m").'-'.$ultimoDia
);
$condicoes['limit'] = 60;
var_dump($condicoes['conditions']);
$this->paginate = $condicoes;
$this->set('aniversariantes', $this->paginate());
}
But it does not work it does not list anything because the string it returns is:
'Funcionario.datNasc >=' => string '09-01' (length=5)
'Funcionario.datNasc <=' => string '2015-09-30' (length=10)
and the datNasc
table returns the complete employee date ex: string '2015-09-18'.