Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在CanvasJS图表中显示格式化的日期时间?_Php_Mysql_Charts_Canvasjs - Fatal编程技术网

Php 如何在CanvasJS图表中显示格式化的日期时间?

Php 如何在CanvasJS图表中显示格式化的日期时间?,php,mysql,charts,canvasjs,Php,Mysql,Charts,Canvasjs,如何在canvas js图表中显示格式化的日期时间 <?php $dateTime = new DateTime($row['Time']); $formatted = $dateTime->format("g:i:s:v a F j, Y");?> 如何使用顶部代码在图表中显示毫秒,如下所示: date("g:i:s:v a F j, Y ", strtotime($row['setTime'])) 显示2018年4月25日下午12:05:10:

如何在canvas js图表中显示格式化的日期时间

 <?php $dateTime = new DateTime($row['Time']);
$formatted = $dateTime->format("g:i:s:v a F j, Y");?>          
如何使用顶部代码在图表中显示毫秒,如下所示:

 date("g:i:s:v a F j, Y ", strtotime($row['setTime'])) 

显示2018年4月25日下午12:05:10:000不显示毫秒。

只需使用顶部的代码和$row['setTime']值,并将其插入数组中即可

$dateTime = new DateTime($row['setTime']);
$setTime = $dateTime->format("g:i:s:v a F j, Y");

$a = array("y" => $row['setPercent'], 'label' => $setTime);
array_push($dataPoints, $a);

谢谢,它显示了毫秒,但它也显示了
未定义变量:行未定义变量:行
,听起来像是一个完全不同的问题。如果该代码为您显示时间,则错误在下面的某个位置。在某些地方,您有一个未定义的$row变量,并且它在标签上使用相同的日期,这不是您告诉它要做的。label=>$SETTIMEYP没问题!干杯
$dateTime = new DateTime($row['setTime']);
$setTime = $dateTime->format("g:i:s:v a F j, Y");

$a = array("y" => $row['setPercent'], 'label' => $setTime);
array_push($dataPoints, $a);