Home forums Chart Support Help with Spline Chart

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #22088

    I understand about using the chart with php my only question is how to convert the Date to Timestamp in the format you use?



    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.

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

    Vishwas R
    Team CanvasJS


    Would i do it like this in my php
    array_push($dataPoints, array("x"=> $row->strtotime(Date)*1000, "y"=> $row->Profits));


    I got it thanks i use
    array_push($dataPoints, array(“x”=> $PHPstr=strtotime($row->Date)*1000, “y”=> $row->Profits));



    Glad that it works :)

    Vishwas R
    Team CanvasJS

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.