var now = new Date();
var nowTime = now.toLocaleString();
var nowTime = now.toLocaleString();
var date = nowTime.substring(0,10).replace(/\//g, "-");//截取日期
console.log(date);则输出为2017-10-26
JavaScript日期格式转换
var date = nowTime.substring(0,10).replace(/\//g, "-");//截取日期
console.log(date);则输出为2017-10-26
2万+
1528
5954

被折叠的 条评论
为什么被折叠?