JS根据日期获取判断星期几

 

  /**
     * 根据日期字符串获取星期几
     * @param dateString 日期字符串(如:2020-05-02)
     * @returns {String}
     */
    function getWeek(dateString) {
        var dateArray = dateString.split("-");
        date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
        return "周" + "日一二三四五六".charAt(date.getDay());
    };

 

上一篇:Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was e


下一篇:vue后退