<script>var time = prompt(\'请输入日期,用\"-\"间隔\');function getDayNum(time) {var brgin = time;// console.log(brgin);var nowyear = time.substr(\'0\', \'4\');// var nowyear = time.getFullYear();var firstTime = +new Date(nowyear + \'-1-1\');var inputTime = +new Date(time);var times = (inputTime - firstTime) / 1000;var d = parseInt(times / 60 / 60 / 24) + 1;alert(time + \'是\' + nowyear + \'的第\' + d + \'天\');// getDayNum(prompt(\'请输入日期,并以\' - \'间隔\'));}getDayNum(time);</script>
欢迎大家一起讨论,共同进步!!