I have a variable in my DB which stores the following value FECHA_MOV= "2015-03-19 04:34:20"
I would like to print (show) the date in this format "d-m-Y" ==> 19-03-2015
. But I get the next date "01-01-1970"
==========codigo============
$pdf->Cell(0,6,$g_chrHead,0,1);
$originalDate = $rows["FECHA_MOV"];
$date = new DateTime($originalDate);
//echo $date->format('d-m-Y'); //esto si funciona
//echo date("d-m-Y",strtotime($originalDate)); // aca sale 01-01-1970
$pdf->SetFont('Courier','',8);
while ($rows = sqlsrv_fetch_array($res_sql, SQLSRV_FETCH_ASSOC)){
//echo date("d-m-Y",strtotime($rows["FECHA_MOV"]));
$cad = str_repeat(" ",5) . substr(date("d-m-Y",strtotime($rows["FECHA_MOV"])) . str_repeat(" ",12),0,14) ;
$cad .= substr($rows["NOM_MOV"] . str_repeat(" ",25),0,27) ;
$cad .= substr($rows["NOM_PAGO"] . str_repeat(" ",25),0,27) ;
$cad .= str_pad(number_format($rows["IMPORTE"],2,".",","), 12, " ", STR_PAD_LEFT) ;
$cad .= str_repeat(" ",3) .substr($rows["NOMBRE"] . str_repeat(" ",10),0,25) ;
$pdf->Cell(0,6,$cad,0,1);
}
}
======================fin =============
How can I correct this error?