well the problem is that when I use this
for($i=0;$i<count($losDatos);$i++)
{
$fecha=new DateTime($losDatos[$i]['fechautc']);
echo $losDatos[$i]['lat'];
echo $losDatos[$i]['lon'];
}
I always get the server date instead of my field name
$losDatos[$i]['fechautc']=2011-03-18 18:47:00.0
the field from the database is Datetime type from SQL , what could be wrong?
previously in the script I used
$initDate=$losDatos[0]['fechautc'];
and it worked well
It’s possible that
$losDatos[$i]['fechautc']isnulland so theDateTimeis just showing the current time. Try dumping the array usingprint_rand see what’s there.