最近在写一个人力考勤功能其中一个功能是获取全年的周六周日节假日,并本地化供考勤处理参考。

方法如下:

public void GetWMDay()

{

   string year ="2013"    

   DateTime  counYear=Convert.ToDateTime(ls_nd+"-01-01");        

   DateTime  nestYear=l_dte1.AddYears(1);      

   for(DateTime i=counYear;i<nestYear;i=i.AddDays(1))        

    {                      

        if ((int)i.DayOfWeek == 0 )  {  // 周日    to do   }

              if ((int)i.DayOfWeek == 6)  {   //周六  to do  }       

    }

 }

方法很简单,记录下来,分享下。

相关文章:

  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2017-12-05
  • 2022-12-23
  • 2022-02-27
相关资源
相似解决方案