0x8; i>>=1) sum += (lunarinfo[y-1900] & i)? 1: 0
return(sum+leapdays(y)) }
//***********************************=== 傳回農曆 y年閏月的天數
function leapdays(y)
//***********************************=== 傳回農曆 y年閏哪個月 1-12 , 沒閏傳回 0
function leapmonth(y)
//***********************************=== 傳回農曆 y年m月的總天數
function monthdays(y,m)
//***********************************=== 算出農曆, 傳入日期物件, 傳回農曆日期物件
// 該物件屬性有 .year .month .day .isleap .yearcyl .daycyl .moncyl
function lunar(objdate)
if(offset<0)
this.year = i
this.yearcyl = i-1864
leap = leapmonth(i) //閏哪個月
this.isleap = false
for(i=1; i<13 && offset>0; i++)
else
//解除閏月
if(this.isleap==true && i==(leap+1)) this.isleap = false
offset -= temp
if(this.isleap == false) this.moncyl ++ }
if(offset==0 && leap>0 && i==leap+1)
if(this.isleap)
else
if(offset<0)
this.month = i
this.day = offset + 1 }
//******************************傳回國歷 y年某m+1月的天數
function solardays(y,m)
//****************************** 傳入 offset 傳回干支, 0=甲子
function cyclical(num)
//****************************** 月曆屬性
function calelement(syear,smonth,sday,week,lyear,lmonth,lday,isleap,cyear,cmonth,cday)
//***** 某年的第n個節氣為幾日(從0小寒起算)
function sterm(y,n)
//****************************** 傳回月曆物件 (y年,m+1月)
function calendar(y,m)
//syear,smonth,sday,week,
//lyear,lmonth,lday,isleap,
//cyear,cmonth,cday
this[i] = new calelement(y, m+1, i+1, nstr1[(i+this.firstweek)%7],
ly, lm, ld++, ll,
cyclical(ldobj.yearcyl) ,cyclical(ldobj.moncyl), cyclical(ldobj.daycyl++) )
if((i+this.firstweek)%7==0) this[i].color = 'red' //週日顏色
if((i+this.firstweek)%14==13) this[i].color = 'red' //週休二日顏色 }
//節氣
tmp1=sterm(y,m*2 )-1
tmp2=sterm(y,m*2+1)-1
this[tmp1].solarterms = solarterm[m*2]
this[tmp2].solarterms = solarterm[m*2+1]
if(m==3) this[tmp1].color = 'red' //清明顏色
//國曆節日
for(i in sftv)
if(sftv[i].match(/^(/d)(/d)([/s/*])(.+)$/))
if(number(regexp.$1)==(m+1))
//月周節日
for(i in wftv)
if(wftv[i].match(/^(/d)(/d)(/d)([/s/*])(.+)$/))
if(number(regexp.$1)==(m+1))
//農曆節日
for(i in lftv)
if(lftv[i].match(/^(/d)(.)([/s/*])(.+)$/)) }
}//黑色星期五
if((this.firstweek+12)%7==5)
this[12].solarfestival += '黑色星期五 '
//今日
if(y==ty && m==tm) this[td-1].istoday = true; }
//********************== 中文日期
function cday(d)
return(s); }
簡易萬年曆
div設定 li body calendar calendar ul calendar li calendar li h2 calendar li p calendar active calendar active p calendar text calendar text h2 calendar ...
製作乙個php萬年曆
1.獲取日期年和月,預設當前年份和月份 2.計算當前月份有多少天和本月1號是星期幾 3.輸出日期的頭部資訊 4.迴圈遍歷輸出輸出天數 1.year empty request y date y intval request y month empty request m date m intval ...
C 做的乙個萬年曆
實現輸出乙個年份後,輸出這個年份的月份 星期 日期 編碼工具 vs2015 下面是 using system using system.collections.generic using system.linq using system.text using system.threading.tas...