Reference: http://blog.sina.com.cn/s/blog_5f571dba0100cvjl.html
After the modification, the values of and are regarded as the 13-month and 14-month of the previous year. For example, if the values are-1-10, the values are converted to-3-13-10 to be substituted into the formula for calculation. The source code does not reduce the year for this problem.
But I tested it and the results were the same.
// Leleapplication1.cpp: defines the entry point of the console application. // # Include <vector> # include <iostream> # include <string> using namespace STD; string caculateweekday (INT y, int M, int D) {If (M = 1) {M = 13; y --;} If (M = 2) {M = 14; y --;} int week = (D + 2 * m + 3 * (m + 1)/5 + Y/4-y/100 + Y/400) % 7; string weekstr = ""; Switch (week) {Case 0: weekstr = "Monday"; break; Case 1: weekstr = "Tuesday"; break; Case 2: weekstr = "Wednesday"; break; Case 3: weekstr = "Thursday"; break; Case 4: weekstr = "Friday"; break; Case 5: weekstr = "Saturday "; break; Case 6: weekstr = "Sunday"; break;} return weekstr;} int main (INT argc, char * argv []) {cout <caculateweekday (2012, 6, 12) <Endl; return 0 ;}