Convert PHP date into javascript date format
It is pretty simple.
PHP code:
$formatted_date = $newticket['DateCreated'] = date('Y/m/d H:i:s');
Javascript code:
var javascript_date = new Date("<?php echo $formatted_date; ?>");
Javascript Date class supports ISO 8601 date format so I would recommend:
<?php
date('c', $yourDateTime);
// or for objects
$dateTimeObject->format('c');
?>
documentation says that:
format character 'c' is ISO 8601 date (added in PHP 5)
example: 2004-02-12T15:19:21+00:00
for more information: http://php.net/manual/en/function.date.php
You should probably just use a timestamp
$newticket['DateCreated'] = strtotime('now');
Then convert it to a Javascript date
// make sure to convert from unix timestamp
var now = new Date(dateFromPHP * 1000);