Home > Article > Web Front-end > Use js to get the week of the year today is (small example, source code attached)
Below are some interesting examples that I have compiled for you. Interested students can take a look.
<script language="JavaScript"> <!-- var d1 = new Date(); var d2 = new Date(); d2.setMonth(0); d2.setDate(1); var rq = d1-d2; var s1 = Math.ceil(rq/(24*60*60*1000)); var s2 = Math.ceil(s1/7); alert("今天是本年第"+s1+"天,第"+s2+"周");//周日做为下周的开始计算 //--> </script>
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to use ajax to operate forms with JavaScript
Detailed explanation of the use of AJAX and JavaScript
What is the difference between .min.js and .js files in javascript?
The above is the detailed content of Use js to get the week of the year today is (small example, source code attached). For more information, please follow other related articles on the PHP Chinese website!