js获取当前日期是年中的第几天constcurrentYear=newDate().getFullYear().toString();//今天减去今年的数字一天(1月1日xxxx)consthasTimestamp=newDate()-newDate(currentYear);//86400000=24*60*60*1000consthasDays=Math.ceil(hasTimestamp/86400000)+1;console.log('今天是%s年的%s日',currentYear,hasDays);//结果:今天是2018年的第329天
