This 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. Y represents the number of years.
Note: There is a different formula in the formula: 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 as 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 ();
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbglzzw55yw5n/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
C # Console Application-"Check out days of the week on a specified date"