js获取当前年⽉⽇-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;
以上这篇js获取当前年⽉⽇-YYYYmmDD格式的实现代码就是⼩编分享给⼤家的全部内容了,希望能给⼤家⼀个参考,也希望⼤家多多⽀持。
因篇幅问题不能全部显示,请点此查看更多更全内容