2
I need to do a calculation that sums an integer to a date. This integer refers to days.
$user = TableRegistry::get('PoliticaSenha');
$query = $user->find()->where(['id' => $usuario['politica_senha_id']])->first();
$dataTrocaUsuario = $usuario->ultima_troca_senha->format("d/m/Y");
$dataValidade = date('d/m/Y', strtotime("+".$query->validade_dias ." days", strtotime($dataTrocaUsuario)));
echo $query->validade_dias;
echo ' - ';
echo $dataValidade;
echo ' - ';
echo $dataTrocaUsuario;
this is my result:
2 - 02/01/1970 - 22/01/2016
I don’t know what’s wrong, I looked all over the internet and that’s what they say to do to add dates. Some help ?
validade_dia
of days is the whole number?– rray
That’s right, as you can see from the echo result.
– Estácio Di Fabio