Send PHP date to JavaScript date format

date('D M d Y H:i:s O')

It won't work if your current locale isn't English.

A better alternative is to use:

new Date(<? echo date("Y, n - 1, d, H, i, s") ?>)

You could also just leave the PHP code as it is and parse the date using JavaScript:

var date = new Date(Date.parse(DATE));

Then even things like this would work:

new Date(Date.parse('11 March 2017'));

Which outputs via a console log (GMT+1000 is because I am in Australia):

Sat Mar 11 2017 00:00:00 GMT+1000

More information is here: https://developer.mozilla.org/enUS/docs/Web/JavaScript/Reference/Global_Objects/Date/parse


$.get('time.php', function(data) {
  today = new Date(data);
  closing = new Date(data);
});

What was the purpose of multiplying the string by 1000? That operation doesn't make sense.

This PHP will work for that.

echo date('D, d M y H:i:s')." +0000";

The PHP code in Luna's answer with echo date isn't exactly like JavaScript code. This will mimic the JavaScript code exactly:

echo date('D M d Y H:i:s O');