标签:set minutes class 获取 src width time 图片 浏览器
(图片来自W3school)
let myDate = new Date(); myDate.setDate(myDate.getDate() + 1); let year = myDate.getFullYear();//getYear()方法也能获取但是部分浏览器不兼容,所以用getFullYear()方法 let month = myDate.getMonth() + 1; //获取的数值是0-11,用来表示月份要+1 let day = myDate.getDay(); let hour = myDate.getHours(); let minute = myDate.getMinutes(); let second = myDate.getSeconds(); if (month < 10) { month = "0" + month; } if (day < 10) { day = "0" + day; } if (hour < 10) { hour = "0" + hour; } if (minute < 10) { minute = "0" + minute; } if (second < 10) { second = "0" + second; } let nowTime = `${year}-${month}-${day} ${hour}:${minute}:${second}`;
标签:set minutes class 获取 src width time 图片 浏览器
原文地址:https://www.cnblogs.com/yamiya/p/12315385.html