基本点:
(1)每个月的日期
const long dayarr[12] = {31,28/29,31,30,31,30,31,31,30,31,30,31};
(2)确定闰年
isleapyear --> (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
(3)确定最大天数
((month-- == 2 && isleapyear(year)) ? dayarr[month] + 1 : dayarr[month])
(4)日期对应的周下标(0~6)
long getweekindex(long date)
{ long year = GETYEAR(date); long month = GETMONTH(date); if(month == 1 || month == 2) { month += 12; --year; } return ((date% 100) + 2 * month + 3 * (month + 1)/5 +year + year/4 - year/100 + year/400 + 1)%7; }
(5)其他细节、显示效果等