笔记 JavaScript获取日期YYYYmmDD(年月日之间可自定义)
var nowDate = new Date();
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1 < 10 ? “0” + (nowDate.getMonth() + 1)
: nowDate.getMonth() + 1;
var day = nowDate.getDate() < 10 ? “0” + nowDate.getDate() : nowDate
.getDate();
var dateStr = year + “-” + month + “-” + day;
https://www.jb51.net/article/85569.htm