php DateTime sql problem
well the problem is that when I use开发者_StackOverflow中文版 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']
is null
and so the DateTime
is just showing the current time. Try dumping the array using print_r
and see what's there.
精彩评论