Parse the string yourself as suggested on
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/parse
It is not recommended to use Date.parse as until ES5, parsing of
strings was entirely implementation dependent. There are still many
differences in how different hosts parse date strings, therefore date
strings should be manually parsed (a library can help if many
different formats are to be accommodated).
I gave you a link to an answer on SO that explains how to do this.
Converting String into date format in JS
This example should work even on very old or very broken browsers.
var lookupMonthName = {
jan: 0,
feb: 1,
mar: 2,
apr: 3,
may: 4,
jun: 5,
jul: 6,
aug: 7,
sep: 8,
oct: 9,
nov: 10,
dec: 11
};
function customParse(dateTimeStr) {
var dateTime = dateTimeStr.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '').split(' ');
var date = dateTime[0].split('-');
date[1] = lookupMonthName[date[1].toLowerCase()].toString();
date.reverse();
var time = dateTime[1].split(':');
if (dateTime[2].toUpperCase() === 'PM') {
time[0] = (parseInt(time[0], 10) + 12).toString();
}
var args = date.concat(time);
console.log(args);
return new Date(Date.UTC.apply(null, args));
}
var str = '05-Sep-2013 01:05:15 PM ';
var date = customParse(str);
document.getElementById('out').appendChild(document.createTextNode(date));
console.log(date);
<pre id="out"></pre>
To format a string from a Date object, see SO answers
Where can I find documentation on formatting a date in JavaScript?
A little effort on your part and you would have been able to find this information yourself.