It involves an algorithm:
Kimlarsson Calculation Formulaw= (d+2*m+3* (m+1)/5+y+y/4-y/100+y/400+1) MoD 7in the formula, D represents the number of days in a date, m represents the number of months, and Y represents the number of years. Note: There is a difference in the formula from the other formulas:consider January and February as the January or March and January or April of the previous year, as in the case of 2004-1-10:2003-13-10 is calculated by substituting the formula. The code is as follows:
Console.Wri Teline ("**************************"); Console.WriteLine ("Enter the day of the month specified)"; Console.WriteLine ("By:yys"); Console.WriteLine ("Today is {0} year {1} month {2} day week {3}", Datetime.now.year,datetime.now.month, DateTime.Now.Day, (int) DateTime.Now.DayOfWeek); Console.WriteLine ("**************************"); Console.foregroundcolor = consolecolor.red; Console.WriteLine ("Please enter the Year:"); int y = System.Int32.Parse (Console.ReadLine ()); Console.WriteLine ("Please enter the month"); int m = System.Int32.Parse (Console.ReadLine ()); Console.WriteLine ("Please enter the day"); int d = System.Int32.Parse (Console.ReadLine ()); Int week = (d + 2 * m + 3 * (M + 1)/5 + y + Y/4-y/100 + y/400 + 1)% 7; Console.WriteLine ("{0} year {1} month {2} days is week {3}", Y,m,d,week); Console.readkey ();
C # Console Program-"Enter the day of the week for the specified month"