DateTime.Now.ToString ("dddd", New System.Globalization.CultureInfo ("ZH-CN"));
Today on the Internet to see some of the implementation of C # on the basis of the day of the week to calculate the introduction:
The algorithm is as follows:
Kimlarsson Calculation formula
w= (d+2*m+3* (m+1)/5+y+y/4-y/100+y/400) MoD 7
in the formula D represents the number of days in the date, m represents the number of months, and 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, for example: if it is 2004-1-10, convert it to: 2003-13-10 to substitute the formula.
The code is as follows:
Y-year, M-month, D-Date
string caculateweekday (int y,int m,int d)
{
string[] weekstr ={"Day", "one", "two", "three", "four", "Five", " VI "};
if (M < 3)
{
m + =;
if (y% = = 0 | | y%!= 0 && y% 4 = 0)
{
d--
}
} else
{
d = 1;
}
Return "Week" + weekstr[(d + 2 * m + 3 * (M + 1)/5 + y + Y/4-y/100 + y/400)% 7];
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.