You need a date in this format for javascript Sun, 01 Sep 13 08:06:57 +0000 So, in PHP you need to do something like this
date_default_timezone_set('Australia/Perth'); echo date('D, d M y H:i:s')." +0000";
And you can experiment with jQuery to check it out
$.get('dateformat.php', function(data) { date = new Date(data); console.log(date); });
Then you can format the date as you wish.
Example for formatting a date object:
$.date = function(dateObj) { var d = new Date(dateObj); var day = d.getDate(); var month = d.getMonth() + 1; var year = d.getFullYear(); if (month < 10) { month = "0" + month; } return year + "." + month + "." + day; };
Jquery plugin to help you format date like php
https://github.com/phstc/jquery-dateFormat
You can use it to apply a format like this
$.format.date("2009-12-18 10:54:50.546", "Test: dd/MM/yyyy")
I think that it is.
source share