Home › Forums › Chart Support › Getting DateTime value from mysql db to create a chart › Reply To: Getting DateTime value from mysql db to create a chart
$dataPoints = array("x" => (strtotime($row)*1000), "y" => $row);
Then convert the array ‘$dataPoints’ into JSON representation using json_encode(). Also, set the `xValueType: “dateTime”` as timestamp values are getting assigned to the chart instead of Date objects as shown below –
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK) ?>
Kindly download the sample PHP project from this link.
The above sample shows how to pass dateTime from a database into Charts in PHP. A ReadMe file has been included for your convenience with all the instructions to set up the project.