我打算用PHP输出一段 XML,有一句总是出错,语法不对!
$strXML .= "<set name='"date_format($row["DatePro"],'%Y-%m')"' value='".$row["Quantity"]."' hoverText='' />";请指教,多谢了!!
$strXML .= "<set name='"date_format($row["DatePro"],'%Y-%m')"' value='".$row["Quantity"]."' hoverText='' />";请指教,多谢了!!
这个两边少了连接符
$strXML .= "<set name='".date_format($row["DatePro"],'%Y-%m')."' value='".$row["Quantity"]."' hoverText='' />";但运行之后提示:
Warning: date_format() expects parameter 1 to be DateTime, string given in D:\wamp\www\chart\index.php on line 59还是这一行有错
可以尝试下,date_format(date_create($row["DatePro"]),'%Y-%m')
是获取的时间格式数据 2003-01-02 17:54:13我估计,date_format 只能处理 日期,不能处理 如 2003-01-02 17:54:13 的时间
strtotime("Y-m-d H:i:s")//输出时间戳格式
date("Y-m-d H:i:s",time())//把时间戳格式输出成2011-02-1 12:0:0 格式