JS 日期补0(2020-3-4转成2020-03-04)

2020-3-4转成2020-03-04

var d = new Date();
var ye = d.getFullYear();
var mo = (d.getMonth()+1).toString().padStart(2,'0');
var da = d.getDate().toString().padStart(2,'0');
var time = ye+'-'+mo+'-'+da;
alert(time);
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页