Home forums Chart Support How to Change date format for PHP Reply To: How to Change date format for PHP

#28587

@salman_emenacsoft,

To convert PHP date to JavaScript timestamp, first, 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. Also, setting xValueType to ‘dateTime’ should work fine in your case.

$phpTimestamp = strtotime("2020-03-05");
$javaScriptTimestamp = $phpTimestamp * 1000;

__
Vishwas R
Team CanvasJS