码迷,mamicode.com
首页 > 其他好文 > 详细

Zeller公式示例

时间:2014-05-07 01:25:49      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   tar   color   

Zeller公式用于计算给定日期是星期几。

bubuko.com,布布扣
 1 //根据日期计算星期几                 
 2                                                 
 3  int SDGSELFLocalTime::CalWhatDay(ST_LOCALDATE& l_stDate)
 4 {
 5  int year = l_stDate.m_nYear;
 6  int month = l_stDate.m_nMonth;
 7  int day = l_stDate.m_nDay;
 8  if (month < 3)
 9  {
10   year -= 1;
11   month += 12;
12  }
13  int c = int(year / 100) , y = year - 100 * c;
14  int w = int(c / 4) - 2*c +y +int(y/4) +(26 * (month + 1)/10) + day - 1;
15  w = (w % 7 + 7) % 7;
16  return w;
17 }
View Code

 

Zeller公式示例,布布扣,bubuko.com

Zeller公式示例

标签:style   blog   class   code   tar   color   

原文地址:http://www.cnblogs.com/AmitX-moten/p/3712216.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!