1. Display Date Code:
2. Display the Lunar code:
/* Get current Lunar/function showcal () {var d=new Date ();
var yy=d.getfullyear ();
var mm=d.getmonth () +1;
var dd=d.getdate ();
var ww=d.getday ();
var ss=parseint (D.gettime ()/1000);
if (yy<100) yy= "+yy";
Return Getlunarday (YY,MM,DD);
//define global variable var calendardata=new Array (100);
var madd=new Array (12);
var tgstring= "A B-n-butyl Xing";
var dzstring= "Kaniko Chen has not Shin Hai";
var numstring= "1,234,567,890";
var monstring= "is 234,567,890 winter wax";
var weekstring= "Day 123456";
var sx= "Mouse cow tiger rabbit snake horse sheep monkey chicken Dog pig";
var cyear,cmonth,cday,thedate; CalendarData = new Array (0XA4B,0X5164B,0X6A5,0X6D4,0X415B5,0X2B6,0X957,0X2092F,0X497,0X60C96,0XD4A,0XEA5,0X50DA9, 0x5ad,0x2b6,0x3126e, 0x92e,0x7192d,0xc95,0xd4a,0x61b4a,0xb55,0x56a,0x4155b, 0x25d,0x92d,0x2192b,0xa95,0x71695, 0x6ca,0xb55,0x50ab5,0x4da,0xa5b,0x30a57,0x52b,0x8152a,0xe95,0x6aa,0x615aa,0xab5,0x4b6,0x414ae,0xa57,0x526, 0x31d26,0xd95,0x70b55,0x56a,0x96d,0x5095d,0x4ad,0xa4d,0x41a4d,0xd25,0x81aa5,0xb54,0xb6a,0x612da,0x95b,0x49b, 0X41497,0XA4B,0XA164B, 0x6a5,0x6d4,0x615b4,0xab6,0X957,0X5092F,0X497,0X64B, 0x30d4a,0xea5,0x80d65,0x5ac,0xab6,0x5126d,0x92e,0xc96,0x41a95,0xd4a,0xda5,0x20b55,
0X56A,0X7155B,0X25D,0X92D,0X5192B,0XA95,0XB4A,0X416AA,0XAD5,0X90AB5,0X4BA,0XA5B, 0x60A57,0x52B,0xA93,0x40E95);
madd[0]=0;
madd[1]=31;
madd[2]=59;
madd[3]=90;
madd[4]=120;
madd[5]=151;
madd[6]=181;
madd[7]=212;
madd[8]=243;
madd[9]=273;
madd[10]=304;
madd[11]=334;
function Getbit (m,n) {return (m>>n) &1; ///Lunar transformation function e2c () {thedate= (arguments.length!=3)? New Date (): new Date (arguments[0],arguments[1],arguments[2)
;
var total,m,n,k;
var Isend=false;
var tmp=thedate.getyear ();
if (tmp<1900) {tmp+=1900;
} total= (tmp-1921) *365+math.floor ((tmp-1921)/4) +madd[thedate.getmonth ()]+thedate.getdate ()-38;
if (Thedate.getyear ()%4==0&&thedate.getmonth () >1) {total++; for (m=0;;;
m++) {k= (CALENDARDATA[M]<0XFFF)? 11:12;
for (n=k;n>=0;n--) {if (Total<=29+getbit (calendardata[m],n)) {isend=true; } total=total-29-getbit (CalENDARDATA[M],N);
} if (isend) break;
} cyear=1921 + M;
cmonth=k-n+1;
Cday=total;
if (k==12) {if (Cmonth==math.floor (calendardata[m]/0x10000) +1) {cmonth=1-cmonth;
} if (Cmonth>math.floor (calendardata[m]/0x10000) +1) {cmonth--;
}} function Getcdatestring () {var tmp= "";
/* Show Agricultural calendar year: (such as: Jiawu (MA) years)//*tmp+=tgstring.charat ((cYear-4)%10);
Tmp+=dzstring.charat ((cYear-4)%12);
tmp+= "(";
Tmp+=sx.charat ((cYear-4)%12);
tmp+= "Year"; */if (cmonth<1) {tmp+= "(leap)";
Tmp+=monstring.charat (-cmonth-1);
}else{Tmp+=monstring.charat (cMonth-1);
} tmp+= "Month"; tmp+= (cday<11)? " The first ":((cday<20)?" Ten ":((cday<30)?"
20 ":" 30 ")); if (cday%10!=0| |
cday==10) {Tmp+=numstring.charat (cDay-1)%10);
return TMP; } function Getlunarday (solaryear,solarmonth,solarday) {//solaryear = solaryear<1900? (
1900+solaryear): solaryear;
if (solaryear<1921 | | solaryear>2020) {return ""; }else{Solarmonth = (parseint (solarmonth) >0)?
(solarMonth-1): 11; E2C (Solaryear,solarmonth,solarday);
return getcdatestring (); }
}
3. Display: