Home Forums Chart Support Help with Spline Chart

Help with Spline Chart

Viewing 5 posts - 1 through 5 (of 5 total)
  • #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?

    #22092

    @lonster_monster,

    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

    #22093

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

    #22094

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

    #22095

    @lonster_monster,

    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.