Home Forums Chart Support Date pass throw php Reply To: Date pass throw php

#37105

@umeshkrishna,

In order to convert PHP date to Charts (JavaScript timestamp), you need to convert PHP date to PHP timestamp using strtotime and then convert PHP timestamp to JavaScript timestamp by multiplying PHP timestamp by 1000 as shown below,

$phpDate = date("Y-m-d h:i:sa");
$phpTimestamp = strtotime($phpDate);
$javaScriptTimestamp = $phpTimestamp * 1000;

You also need to set xValueType property to ‘dateTime’ as x-value will be a timestamp.

Chart with PHP timestamp values

__
Adithya Menon
Team CanvasJS