I’ve been working on projects lately. The project is now finally in a stable state, just making modifications and changes. As a backend programmer, I have a really hard time. I have to write everything from web to mobile interfaces, all kinds of things. . . I finally had some free time in the past two days. I took a look at some functions about js date. Suddenly I thought of the calendar control, so I tried to write one. As a background programmer, my level is limited. Please take a look at it with a learning attitude. Let me write this example. . .
First, a commonly used date function: Date(year,month,day)
Get the year
Get the month, here is the month index so 1
Get the date of the day
Get the day of the week and return 0. Sunday 1. Monday 2. Tuesday 3. Wednesday 4. Thursday 5. Friday 6. Saturday
Get the day of the week the first of the month is
Get the number of days in the current month
The following are actually some operations and judgments about the date corresponding to the day of the week, and dynamic splicing tags. I will directly send the example I wrote: