把一个Date对象的js日期 , 格式化为比如20200529形式 , 可以参考这个函数

                //格式化时间
                formateTime(t){
                    if(t instanceof Date){
                        let year = t.getFullYear();
                        let month = t.getMonth()+1;
                        month =  month < 10 ? "0"+month : month;
                        let day = t.getDate();
                        day =  day < 10 ? "0"+day : day;
                        console.log(year,month,day);
                        res=year+""+month+""+day;
                        return res; 
                    }
                    return "";
                }

 

相关文章:

  • 2021-11-10
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
  • 2022-12-23
猜你喜欢
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-03-01
  • 2022-12-23
  • 2021-06-05
  • 2022-03-05
相关资源
相似解决方案