当前位置:   article > 正文

c语言程序设计答案万年历备忘录,基于JavaScript(网页脚本语言)编写的万年历(含源文件)...

万年历js备忘录

var i, sum = 348

for(i=0x8000; i>0x8; i>>=1) sum += (lunarInfo[y-1900] & i)? 1: 0

return(sum+leapDays(y))

}

//====================================== 传回农历y年闰月的天数

function leapDays(y) {

if(leapMonth(y)) return((lunarInfo[y-1900] & 0x10000)? 30: 29)

else return(0)

}

//====================================== 传回农历y年闰哪个月1-12 , 没闰传回0

function leapMonth(y) {

return(lunarInfo[y-1900] & 0xf)

}

//====================================== 传回农历y年m月的总天数

function monthDays(y,m) {

return( (lunarInfo[y-1900] & (0x10000>>m))? 30: 29 )

}

//====================================== 算出农历, 传入日期物件, 传回农历日期物件

// 该物件属性有.year .month .day .isLeap .yearCyl .dayCyl .monCyl

function Lunar(objDate) {

var i, leap=0, temp=0

var baseDate = new Date(1900,0,31)

var offset = (objDate - baseDate)/86400000

this.dayCyl = offset + 40

this.monCyl = 14

for(i=1900; i<2050 && offset>0; i++) {

temp = lYearDays(i)

offset -= temp

this.monCyl += 12

}

if(offset<0) {

offset += temp;

i--;

this.monCyl -= 12

}

this.year = i

this.yearCyl = i-1864

leap = leapMonth(i) //闰哪个月

this.isLeap = false

for(i=1; i<13 && offset>0; i++) {

//闰月

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/673705
推荐阅读
相关标签
  

闽ICP备14008679号