### directory

Week 1, January 1, 1 (Pianya)

Week 1 (Pianya), January 1, 2018 (year)

Calculation formula for the number of leap year before a certain year:

(y-1)/4 –(y-1)/100 + (y-1)/400

Calculating formula for the week on January 1, January 1st:

w = (y + (y-1)/4 –(y-1)/100 + (y-1)/400) % 7

Assuming the standard for 28 days a month, there is (Pingyan):

So there is a list of errors (flat year):

e[] = {0,3,3,6,1,4,6,2,5,0,3,5}

Algorithm on the week of each month on the 1st of each month (Pingyan):

w = (e[m-1] + y + (y-1)/4 –(y-1)/100 + (y-1)/400) % 7

The algorithm (including leap year) every month on the 1st of the month on the first month of the month:

w = (e[m-1] + y + y/4 –y/100 + y/400) % 7

(Among them, the week of January February of the leap year was -1, and the week of January February in the next year of the leap year was +1)

The first day of each year is March 1st, and January February of each year is used as January November. By January February of the BC), you need to re -derive.

Supplement assumption: March 1, 1st year 4 (Pianyan)

Calculating formula for the week of March 1st on March 1st:

w = (3 + y + (y-1)/4 –(y-1)/100 + (y-1)/400) % 7

New error list (Pingyan):

So there is a new list of errors (flat year):

e[] = {0,3,5,1,3,6,2,4,0,2,5,1}

Algorithm on the week of each month on the 1st of the month (Pingyan):

w = (e[m-3] + y + (y-1)/4 –(y-1)/100 + (y-1)/400) % 7

The algorithm (including leap year) every month on the 1st of the month on the first month of the month:

w = (e[m-3] + y + y/4 –y/100 + y/400) % 7

Considering the mapping “f: m -> e [m -3]”, the predecessors found out their relationship:

f(m) = -1 + 2*m + 3*(m+1)/5

The algorithm (including leap year) every month on the 1st of the month on the 1st of each month:

w = (-1 + 2*m + 3*(m+1)/5 + y + y/4 –y/100 + y/400) % 7

The algorithm (including leap year) per day per month per month:

w = (d + 1 + 2*m + 3*(m+1)/5 + y + y/4 –y/100 + y/400) % 7

The algorithm (including leap year) every day every month per month:

w = (d + 2*m + 3*(m+1)/5 + y + y/4 –y/100 + y/400) % 7 + 1

test formula is established:

- Test on January 1, 1: 1: 1: 0 (pretending to exist) on January 1st year, and found it.
- Test on Sunday, October 12, 2018, it was found to be established.
- Test on Sunday, October 12, 2019, found out.
- Inspection on Sunday, October 12, 2020, it was found to be established.
- Inspection on October 12, 2021, 221, and found it.

w = (d + 2*m + 3*(m+1)/5 + y + y/4 – y/100 + y/400) % 7 + 1

Use conditions:

- 1 year and after the year.
- Calculate the data of the day of January February of the year to use the data of the previous year.
- result is a number of 1 to 7.
- Please give legal data. If I use “September 31, 2018”, I don’t know what to get.

[1] White Xiaobai Ani. Try to talk about Kimralson Date formula [eb/ol]. Https://blog.csdn.net/qq_33114231/artail/details/52352668. 2018-10-18.

Instructions:

This article summarizes the blog from CSDN blog owner Bai Xiaobai Ani,

There may be inadequate consideration, welcome to point out.