The current time instance code is displayed on the JavaScript page in real time.
Preface
I have read the relevant content again this time, and I will summarize the points that need attention as follows:
1. PassgetDay()
The number of weeks starts from 0. 0 indicates Sunday, and then from 1 ~ 6 indicates Monday to Saturday in sequence;
2. To get the date, usegetDate()
InsteadgetDay()
Because it may habitually think that a date is a day, it may be usedgetDay()
, But actuallygetDay()
Is used to obtain the number of weeks;
3. PassgetMonth()
To get the month, count from 0, so you need to add 1 more.
The instance code is as follows:
<Html>
Summary
The above is the use of JavaScript to achieve real-time display of all the content of the page, the method described in this article is very easy to understand, very suitable for everyone to learn or directly use, I hope the content of this article will help you in your study or work. If you have any questions, you can leave a message.