Javascript does not come with a date formatting library beyond the one specific format you see. You can either build your own by piecing together the exact pieces you want and adding the strings together or you can get a third party date formatting library.
If you want a 3rd party library, the Datejs library is pretty thorough. In that library, it would be:
Date.today().toString("ddd MMM d yyyy H:mm:ss");
You could, of course obtain all the component values from the built-in date object and then build your own string too.
Without adding a library, you'd have to write your own way to make that specific format:
function formatDate(date) {
function makeTwoDigits(val) {
var prefix = val <= 9 ? "0" : "";
return prefix + val;
}
var dayOfWeek = date.getDay(); // 0-6, 0=Sunday
var month = date.getMonth(); // 0-11
var day = date.getDate(); // 1-31
var year = date.getFullYear(); // 2013
var hours = makeTwoDigits(date.getHours()); // 0-23
var mins = makeTwoDigits(date.getMinutes()); // 0-59
var secs = makeTwoDigits(date.getSeconds()); // 0-59
var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
return days[dayOfWeek] + " " + months[month] + " " + day + " " + year + " " +
hours + ":" + mins + ":" + secs;
}
Working demo: http://jsfiddle.net/jfriend00/zu7Uz/
new Dateis implementation dependent, so you'd be better off making up your own string from the UTC epoch timestamp. Why don't you want to (or can't) use regular expressions/string formatting?