如何使用循环概念检查选定的日期是星期一还是不在日历中? [英] How Do I Use Loop Concepts To Check Whether The Selected Day Is Monday Or Not In A Calendar ?

查看:101
本文介绍了如何使用循环概念检查选定的日期是星期一还是不在日历中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
  {
      DateTime dtime1 = new DateTime();
      dtime1 = Calendar1.SelectedDate;

      int Totaldays = DateTime.DaysInMonth(dtime1.Year, dtime1.Month);

      for (int i = 1; i <= Totaldays; i++)
      {
          var d = new DateTime(dtime1.Year, dtime1.Month, i);

          if (d.DayOfWeek == DayOfWeek.Monday)
          {
              Response.Write(d.ToString("dd/MM/yyyy")+"</br>");
          }

      }

  }





在上面的程序中,我需要检查它是否是星期一而不是DayOfWeek方法。我如何通过使用循环概念进行检查?



In the above program,i need to check whether it is Monday or not instead of DayOfWeek method. How do i check by using loop concepts in this ?

推荐答案

好的,因为这显然是学校工作,而邪恶的老师实际上想要你学习一些东西,我建议学习一下。



这个链接可以帮助你。



http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week [ ^ ]
Ok, as this apparently is school work and the "evil" teacher actually wants you to learn something, I recommend to study a bit.

This link should help you along.

http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week[^]


这篇关于如何使用循环概念检查选定的日期是星期一还是不在日历中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆