js格式化星期
JavaScipt
2019-01-17 18:07:22
js格式化星期几
完整代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
var dates = new Date();
Date.prototype.getWeek=function(fmt){
var xinq = this.getDay();
var xinqArray = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var strWeek;
for(var weeki=0;weeki<xinqArray.length;weeki++){
strWeek = xinqArray[xinq];
}
return strWeek;
};
var day = dates.getWeek();
console.log("星期几:"+day)
</script>
</body>
</html>
结果:
星期几:星期四
六月初字帖坊小程序
你想要的字帖模板及工具,这里都有!
877篇文章
1442人已阅读