Helper::mysqlDate2JsTimestamp PHP Method

mysqlDate2JsTimestamp() public static method

Convert mysql format datetime to JS timestamp (milliseconds since unix epoch).
public static mysqlDate2JsTimestamp ( string $value ) : float
$value string
return float
    public static function mysqlDate2JsTimestamp($value)
    {
        $time = strtotime($value);
        return $time ? $time * 1000 : null;
    }

Usage Example

 public function run()
 {
     $chart = $this->createWidget('FlotChart', array('chart_id' => 'iop-history-chart'))->configureChart(array('colors' => array('#4daf4a', '#984ea3', '#4daf4a', '#984ea3')))->configureXAxis(array('mode' => 'time'))->configureYAxis('mmHg', array('min' => 0, 'max' => 80))->configureSeries('RE', array('points' => array('show' => true), 'lines' => array('show' => true)))->configureSeries('LE', array('points' => array('show' => true), 'lines' => array('show' => true)))->configureSeries('Target RE', array('colors' => array("#fff", "#fff", "#fff"), 'points' => array('show' => true), 'dashes' => array('show' => true, 'style' => array(6))))->configureSeries('Target LE', array('points' => array('show' => true), 'dashes' => array('show' => true, 'style' => array(6))));
     $events = $this->event_type->api->getEventsInEpisode($this->episode->patient, $this->episode);
     foreach ($events as $event) {
         if ($iop = $event->getElementByClass('OEModule\\OphCiExamination\\models\\Element_OphCiExamination_IntraocularPressure')) {
             $timestamp = Helper::mysqlDate2JsTimestamp($event->event_date);
             $this->addIop($chart, $iop, $timestamp, 'right');
             $this->addIop($chart, $iop, $timestamp, 'left');
         }
     }
     $plan = $this->event_type->api->getMostRecentElementInEpisode($this->episode->id, $this->event_type->id, 'OEModule\\OphCiExamination\\models\\Element_OphCiExamination_OverallManagementPlan');
     if ($plan) {
         $this->addTargetIop($chart, $plan, 'right');
         $this->addTargetIop($chart, $plan, 'left');
     }
     $this->render('OphCiExamination_Episode_IOPHistory', array('chart' => $chart));
 }
All Usage Examples Of Helper::mysqlDate2JsTimestamp