如何将当前日期显示在jquery中作为“2015年10月31日星期六”?我只能找到如何让日期显示为“dd / mm / yyyy”
答案 0 :(得分:2)
要获得 2015年10月31日,请使用:
// "31/10/2015" and august : 31/08/2015 :
var a=new Date();
alert([("0" + a.getDate()).slice(-2), ("0" + (a.getMonth()+1)).slice(-2), a.getFullYear()].join("/"));
// "31/10/2015" and august : 31/8/2015 :
[a.getDate(), (a.getMonth() + 1), a.getFullYear()].join("/");
示例:
function getDate() {
var a=new Date();
return [("0" + a.getDate()).slice(-2), ("0" + (a.getMonth() + 1)).slice(-2), a.getFullYear()].join("/");
}
document.write(getDate());
答案 1 :(得分:1)
答案 2 :(得分:1)
你可以:
Sunday, November 1, 2015
if(sum.toString().length == 1)