Home Forums Chart Support Date Format Reply To: Date Format



To display the chart containing datetime value in PHP, you need to first convert datetime string to PHP timestamp using strtotime(). Later convert PHP timestamp value to javascript timestamp and assign that value to dataPoint x-value along with setting xValueType to ‘dateTime’. Please take a look below code snippet for the same.

array_push($dataPoints, array("x"=> strtotime($row->x) * 1000, "y"=> $row->y));

Priyanka M S
Team CanvasJS