I need to make a calculation that adds an integer to a date. This whole number 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 do not know what's wrong, I searched the entire internet and that's what they say to do to add dates. Any help?