Вы можете использовать эту функцию
//example: dateFormater("D, M n, Y h:ft", new Date(), 2)
//results: a formated date two days from now -> Sunday, February 10, 2013 3:07pm
//today is Friday 2/8/13
function dateFormater (mod, nDate, addDay) {
var daysFull = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var daysAbbr = ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."];
var monthsFull = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var monthsAbbr = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."];
var moddt = "";
var tmp;
//add days to date (use -1 to subtract days
if (typeof addDay !== 'undefined') nDate.setDate(nDate.getDate() + addDay);
var dateMod = mod.split("");
for (el in dateMod) {
switch(dateMod[el]) {
//Delimiters: ,=, /=/ " "=" " :=:
case ",":
moddt += dateMod[el];
break;
case "/":
moddt += dateMod[el];
break;
case " ":
moddt += dateMod[el];
break;
case ":":
moddt += dateMod[el];
break;
//Month: M=January m=Jan. J=01 j=1
case "M":
moddt += monthsFull[nDate.getMonth()];
break;
case "m":
moddt += monthsAbbr[nDate.getMonth()];
break;
case "J":
tmp = nDate.getDate();
tmp = tmp.toString();
if (tmp.length == 1) {
moddt += "0" + tmp;
} else {
moddt += tmp;
}
break;
case "j":
tmp = nDate.getDate();
moddt += tmp.toString();
break;
//Day: D=Monday d=Mon. N=01 n=1
case "D":
moddt += daysFull[nDate.getDay()];
break;
case "d":
moddt += daysAbbr[nDate.getDay()];
break;
case "N":
tmp = nDate.getDate();
tmp = tmp.toString();
if (tmp.length == 1) {
moddt += "0" + tmp;
} else {
moddt += tmp;
}
break;
case "n":
tmp = nDate.getDate();
moddt += tmp.toString();
break;
//Year: Y=2013 y=13
case "Y":
moddt += nDate.getFullYear();
break;
case "y":
tmp = nDate.getFullYear();
tmp = tmp.toString();
moddt += tmp.substr(2, 2);
break;
//Hour: H=08 h=8 Military: Z=14 z=01
case "H":
tmp = nDate.getHours();
if (tmp > 12) tmp -= 12;
tmp = tmp.toString();
if (tmp.length == 1) {
moddt += "0" + tmp;
} else {
moddt += tmp;
}
break;
case "h":
tmp = nDate.getHours();
if (tmp > 12) tmp -= 12;
moddt += tmp.toString();
break;
case "Z":
tmp = nDate.getHours();
tmp = tmp.toString();
if (tmp.length == 1) {
moddt += "0" + tmp;
} else {
moddt += tmp;
}
break;
case "z":
tmp = nDate.getHours();
moddt += tmp.toString();
break;
//Minute: f=08
case "f":
tmp = nDate.getMinutes();
tmp = tmp.toString();
if (tmp.length == 1) {
moddt += "0" + tmp;
} else {
moddt += tmp;
}
break;
//Seconds: s=08
case "s":
tmp = nDate.getSeconds();
tmp = tmp.toString();
if (tmp.length == 1) {
moddt += "0" + tmp;
} else {
moddt += tmp;
}
break;
//AM/PM: T=AM/PM t=am/pm q=a/p
case "T":
if (nDate.getHours() > 11) {
moddt += "PM";
} else {
moddt += "AM";
}
break;
case "t":
if (nDate.getHours() > 11) {
moddt += "pm";
} else {
moddt += "am";
}
break;
case "q":
if (nDate.getHours() > 11) {
moddt += "p";
} else {
moddt += "a";
}
break;
}
}
return moddt;
}