2
Guys, I needed a help to display on the screen the Birthday of the Month ordered by the day, in the bank he pulls the information from Senior so the date comes ex: 1970-10-30, in my controller is like this:
public function index()
{
$condicoes['order'] = array('Funcionario.data_nascimento' => 'ASC');
$condicoes['conditions'] = array(
'Funcionario.situacao_afastamento <>' => 7,
"DATE_FORMAT(Funcionario.data_nascimento, '%m') = DATE_FORMAT(NOW(), '%m')"
);
$condicoes['limit'] = 59;
$this->paginate = $condicoes;
$this->set('aniversariantes', $this->paginate());
}
In this condition he first orders the date of the year :( and then the date of the month.
Hello, so I tried it an hour but it doesn’t validate if I put it that way. :(
– Rodrigo Gaster
As well as validation ?
– Diego Souza
It skips that condition, and displays employees randomly.
– Rodrigo Gaster
What kind of field
data_nascimento
?– Diego Souza
Field of type DATE
– Rodrigo Gaster
Are you using any
datatable
?– Diego Souza
I ended up doing it in the hand anyway, thanks for the help. was like this: [$aniversariantes = $this->funcionario->query("select matricula, nome, data_nascimento, data_admissao, local_id from 002_funcionarios WHERE situacao_afastamento <> 7 and Extract(Month from data_nascimento) = DATE_FORMAT(NOW(), '%m') order by Extract(Month from data_nascimento), Extract(day from data_nascimento)"); ]
– Rodrigo Gaster