我试着在文本框中写 Even Weekend 或 Wekend,但什么也没有出现。
DateTime thisDate1 = DateTime.Now;
int day = thisDate1.DayOfYear;
int week = day / 7;
bool even = true;
if ((week % 2) == 0) even = true;
if ((week % 2) == 1) even = false;
if (even == true)
{
if ((int)thisDate1.DayOfWeek == 6) textBox1.Text = "Even Weekend";
if ((int)thisDate1.DayOfWeek == 7) textBox1.Text = "Even Weekend";
}
if (even == false)
{
if ((int)thisDate1.DayOfWeek == 6) textBox1.Text = "Weekend";
if ((int)thisDate1.DayOfWeek == 7) textBox1.Text = "Weekend";
}
非常感谢您的每一个回答。