I have a PHP script that outputs an array of data. This is then transformed into JSON
using the json_encode()
function.
My issue
An improvement or simplification of @jeremyharris answer would be this one:
DateTime objects in PHP have the getTimestamp()
format, use it and multiply the value by 1000:
<?php
$phpDateTimeStamp = new Date('Y/m/d H:i:s')->getTimestamp() * 1000;
?>
// JavaScript
let startTime = new Date(phpDateTimeStamp);
$newticket['DateCreated'] = date('d-m-Y G:H', strtotime($phpDateVariable));