<script type= "Text/javascript" > <!-- var now=new Date (); --> </script> <script language=javascript> <!-- var lunarinfo=new Array (0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2, 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977, 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970, 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950, 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557, 0X06CA0,0X0B550,0X15355,0X04DA0,0X0A5D0,0X14573,0X052D0,0X0A9A8,0X0E950,0X06AA0, 0X0AEA6,0X0AB50,0X04B60,0X0AAE4,0X0A570,0X05260,0X0F263,0X0D950,0X05B57,0X056A0, 0X096D0,0X04DD5,0X04AD0,0X0A4D0,0X0D4D4,0X0D250,0X0D558,0X0B540,0X0B5A0,0X195A6, 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570, 0X04AF5,0X04970,0X064B0,0X074A3,0X0EA50,0X06B58,0X055C0,0X0AB60,0X096D5,0X092E0, 0X0C960,0X0D954,0X0D4A0,0X0DA50,0X07552,0X056A0,0X0ABB7,0X025D0,0X092D0,0X0CAB5, 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930, 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530, 0X05AA0,0X076A3,0X096D0,0X04BD7,0X04AD0,0X0A4D0,0X1D0B6,0X0D250,0X0D520,0X0DD45, 0X0B5A0,0X056D0,0X055B2,0X049B0,0X0A577,0X0A4B0,0X0AA50,0X1B255,0X06D20,0X0ADA0);
= = The total number of days returned to the lunar year Y function Lyeardays (y) { var i, sum = 348 For (i=0x8000 i>0x8; i>>=1) sum = = (lunarinfo[y-1900] & i)? 1:0 Return (Sum+leapdays (y)) } = = The number of days to return the lunar calendar y-year leap function Leapdays (y) { if (Leapmonth (y)) return ((lunarinfo[y-1900] & 0x10000)? 30:29) else return (0) } = = To return to the lunar calendar y year 1-12, no leap back to 0 function Leapmonth (y) {return (lunarinfo[y-1900] & 0xf)} ====================================== returns the total number of days of the lunar calendar Y-year m-months function Monthdays (y,m) {return (lunarinfo[y-1900] & (0x10000>>m)) 30:29)} = = Calculate the lunar calendar, incoming Date object, return the Lunar date object The object property has. Year month. 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); Which month does the leap This.isleap = False For (I=1 i<13 && offset>0; i++) { Leap if (leap>0 && i== (leap+1) && this.isleap==false) {I. THIS.ISLEAP = true; temp = Leapdays (this.year);} Else {temp = Monthdays (this.year, i);} Lift Leap Month 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) {this.isleap = false;} Else {this.isleap = true;--this.moncyl;} if (offset<0) {offset = temp;--this.moncyl; This.month = i This.day = offset + 1 } function Cday (m,d) { var nstr1 = new Array (' Day ', ' one ', ' two ', ' three ', ' four ', ' five ', ' six ', ' seven ', ' eight ', ' nine ', ' ten '); var nstr2 = new Array (' early ', ' ten ', ' 20 ', ' 30 ', '); var s; if (m>10) {s = ' ten ' +nstr1[m-10]} else {s = nstr1[m]} s + = ' month ' if (s== "December") s = "Lunar"; if (s== "January") s = "First month"; Switch (d) { Case 10:s + = ' decade '; Break Case 20:s + = ' 20 '; Break Case 30:s + = ' 30 '; Break Default:s + + Nstr2[math.floor (D/10)]; s + + nstr1[d%10]; } return (s); } function Solarday2 () { var sdobj = new Date (Now.getfullyear (), Now.getmonth (), now.getdate ()); var ldobj = new Lunar (sdobj); var cl = '; Lunar New Year BB ' + (cld[d].isleap? ') Leap ': ' +cld[d].lmonth+ ' month ' +cld[d].lday+ ' Day var tt = Cday (ldobj.month,ldobj.day); document.write (Now.getfullyear () + "year" + (Now.getmonth () +1) + "month" +now.getdate () + "Japanese Lunar Calendar" +tt+ "); } Solarday2 (); --> </script> |