I have this function in php:
private function setInfoTareasDiarias($aDataTarea,$idUsu,$seccion){
print_r($aDataTarea['fecha']);
$date=date("Y/m/d 00:00:00", strtotime($aDataTarea['fecha']));
$aData['porcentaje']=$aDataTarea['porcentaje'];
$aData['fecha_termino']=$date;
$aData['descripcion']=$aDataTarea['descripcion'];
$aData['id_tarea']=$aDataTarea["idTarea"];
$aData['id_seccion']=$seccion;
$this->aDatosInfoTareasDiarias[]=$aData;
print_r($this->aDatosInfoTareasDiarias);
}
print_r($aDataTarea['fecha']);
print this format:
example: 2015/06/9
With $date=date("Y/m/d 00:00:00", strtotime($aDataTarea['fecha']));
and
$aData['fecha_termino']=$date;
I need print :
[fecha_termino] => 2015/06/09 00:00:00
But print:
[fecha_termino] => 1969/12/31 00:00:00
(I need always 00:00:00)
How can I fix this?
You need to specify hours, minutes and seconds as H:i:s, like this:
The reason you are getting 1969/12/31 00:00:00 as the result is because this is the default unix timestamp, which basically means there is an error when you try to generate a date from your given timestamp. Try the H:i:s format shown above and this should work for you now.