Copy Code code as follows:
var lunardate = {
Madd:new Array (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334),
Hsstring: ' N-Xing ',
Ebstring: ' Kaniko Chen has not Shin at all in the afternoon,
numstring: "1,234,567,890",
Monstring: "234,567,890 Winter Wax",
Calendardata:new Array (0xa4b, 0x5164b, 0x6a5, 0x6d4, 0x415b5, 0x2b6, 0x957, 0x2092f, 0x497, 0x60c96, 0xd4a, 0xEA5, 0x50DA 9, 0X5AD, 0x2b6, 0x3126e, 0x92e, 0x7192d, 0xc95, 0xd4a, 0x61b4a, 0xb55, 0x56a, 0x4155b, 0x25d, 0x92d, 0x2192b, 0xA95, 0x71 695, 0x6ca, 0xb55, 0x50ab5, 0x4da, 0xa5b, 0x30a57, 0x52b, 0x8152a, 0xe95, 0x6aa, 0X615AA, 0xab5, 0x4b6, 0x414AE, 0xA57, 0x 526, 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, 0x416 AA, 0xad5, 0x90ab5, 0x4ba, 0xa5b, 0x60a57, 0x52b, 0xa93, 0x40e95),
Year:null,
Month:null,
Day:null,
Thedate:null,
Getbit:function (M, n) {
Return (M >> n) & 1;
},
E2c:function () {
This. Thedate = (arguments.length!= 3)? New Date (): new Date (Arguments[0], arguments[1], arguments[2]);
var total, M, N, K;
var isend = false;
var tmp = this. Thedate.getfullyear ();
Total = (tmp-1921) * 365 + Math.floor ((tmp-1921)/4) + This.madd[this. Thedate.getmonth ()] + this. Thedate.getdate ()-38;
if (this. Thedate.getyear ()% 4 = 0 && this. Thedate.getmonth () > 1) {
total++;
}
for (m = 0;; m++) {
K = (this. Calendardata[m] < 0XFFF)? 11:12;
for (n = k; n >= 0; n--) {
if (total <= + this.) Getbit (this. Calendardata[m], N)) {
Isend = true;
Break
}
Total = Total-29-this. Getbit (this. Calendardata[m], N);
}
if (isend)
Break
}
This. Year = 1921 + M;
This. Month = k-n + 1;
This. Day = total;
if (k = = 12) {
if (this. Month = = Math.floor (this. CALENDARDATA[M]/0x10000) + 1) {
This. Month = 1-this. Month;
}
if (this. Month > Math.floor (this. CALENDARDATA[M]/0x10000) + 1) {
This. month--;
}
}
},
Getcdatestring:function () {
var tmp = "";
TMP = this. Hsstring.charat (this. Year-4)% 10);
TMP = this. Ebstring.charat (this. Year-4)% 12);
TMP = = "Year";
if (this. Month < 1) {
TMP + = "(Leap)";
TMP = this. Monstring.charat (-this. MONTH-1);
} else {
TMP = this. Monstring.charat (this. MONTH-1);
}
TMP = "month";
TMP + = (this. Day < 11)? "Beginning": (this. Day < 20)? "Ten": (this. Day < 30)? "20": "30"));
if (this. Day% 10!= 0 | | This. Day = = 10) {
TMP = this. Numstring.charat (this. Day-1)% 10);
}
return TMP;
},
Getlunarday:function (Solaryear, Solarmonth, Solarday) {
if (Solaryear < 1921 | | solaryear > 2020) {
Return "";
} else {
Solarmonth = (parseint (solarmonth) > 0)? (solarMonth-1): 11;
THIS.E2C (Solaryear, Solarmonth, Solarday);
return this. Getcdatestring ();
}
}
};
Call Method:
Copy Code code as follows:
Lunardate.getlunarday (2013, 1, 24);