JS日期转星期函数

410 阅读1分钟
    var s =  '2021-06-02'; 
    console.log( "今天星期 "+"天一二三四五六 ".charAt(new   Date(s).getDay())); //今天星期 三
    console.log("星期 "   +   new   Date(s).getDay()); //今天星期 3