Description: The calendar is arranged in a cycle every 400 years, which is exactly the same as the month, day, week and 400 years ago. The current astronomical calendar is taken 365.2425 days per year according to the law of celestial body operation. So, every 400 years, 365.2425 times 400 is 146,097 days. If you take 365 days as a year, you'll be less than 0.2425 x 400 = 97 days per 400 years. These 97 days have to be set up in a leap year (366 per year), so 97 leap years are set for every 400 years.
Programming ideas: according to the above background, it is necessary to determine the rule of leap year: if a year is divisible by 4 but cannot be divisible by 100, or if it can be divisible by 400, it is a leap year. The rules can be used to calculate the formula of the perpetual calendar:
S = X + 1/4 - (X - 1) / 100 (X - 1) + (X - 1) / 400 + c type: X is the number of years (e.g., 2003); C is the total number of days to be counted from the New Year's day (e.g., March 23, 2003, C=31+28+23 = 82). The remainder of S/7 is a few weeks.
To Search:
File list (Check if you may need any files):