//时间戳转换functionformatDateTime(inputTime){let date =newDate(inputTime);let y = date.getFullYear();let m = date.getMonth()+1;
m = m <10?('0'+ m): m;let d = date.getDate();
d = d <10?('0'+ d): d;let h = date.getHours();
h = h <10?('0'+ h): h;let minute = date.getMinutes();let second = date.getSeconds();
minute = minute <10?('0'+ minute): minute;
second = second <10?('0'+ second): second;return y +'-'+ m +'-'+ d +' '+ h +':'+ minute +':'+ second;};//获取目标月份第一天零点零分零秒的时间戳functiongetMounthData(mounth){let data =newDate();
data.setDate(1);
data.setHours(0);
data.setSeconds(0);
data.setMinutes(0);
data.setMonth(mounth -1)
console.log(formatDateTime(data.getTime()),'的时间戳为:', data.getTime());}getMounthData(8)
//时间戳转换function formatDateTime(inputTime) { let date = new Date(inputTime); let y = date.getFullYear(); let m = date.getMonth() + 1; m = m < 10 ? ('0' + m) : m; let d = date.getDate(); d = d < 10 ? ('0' + d) : d; let h = date.getHours(