//日期转换星期(基姆拉尔森公式)
  private string CaculateWeekDay(int y,int m,int d)
  {
   //一月和二月被当作前一年的
   if((m==1)||(m==2))
   {
    m+=12;
    y--;
   }
   int week=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;
   string weekstr="";
   switch(week)
   {
    case 0: weekstr="星期一"; break;
    case 1: weekstr="星期二"; break;
    case 2: weekstr="星期三"; break;
    case 3: weekstr="星期四"; break;
    case 4: weekstr="星期五"; break;
    case 5: weekstr="星期六"; break;
    case 6: weekstr="星期日"; break;
   }
   return weekstr;
  }

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2021-07-07
  • 2021-10-07
  • 2021-05-21
  • 2021-11-10
  • 2022-02-24
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2021-07-26
  • 2022-01-23
  • 2021-09-04
相关资源
相似解决方案