js获取某年某月一共多少天

const getDaysInMonth = (year, month) => {  
    let date = new Date(year, month, 1);  
    return new Date(date.getTime() - 864e5).getDate();  
} 

getDaysInMonth(2018,02)
// 28

  

猜你喜欢

转载自www.cnblogs.com/lfqcode/p/9660830.html