字符串日期转换为周

 String.prototype.toWeek=function(){
        var date = new Date(this);
        var week = "";
        switch (date.getDay()) {
            case 0:week = "周日";break;
            case 1:week = "周一";break;
            case 2:week = "周二";break;
            case 3:week = "周三";break;
            case 4:week = "周四";break;
            case 5:week = "周五";break;
            case 6:week = "周六";break;
        }
        return week;
    }

 

posted @ 2017-12-25 11:48  刘浩2561179983  阅读(368)  评论(0编辑  收藏  举报