Function Calconv () {firstyear = 1998; Lastyear = 2031;
Today = new date (); Solaryear = Today.getFullyear (); Solarmonth = Today.getMonth () 1; Solardate = Today.getdate (); weekday = Today.getDay ();
Lunarcal =
[New Taglunarcal (27, 5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1), new taglunarcal (46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1), / * 88 * / New Taglunarcal (35, 0, 5, 53, 1, 1, 0, 0 , 1, 0, 1, 0, 1, 1, 0, 1), / * 89 * / New Taglunarcal (23, 4, 0, 59, 1, 1, 0, 1, 0, 1, 0) 0, 1, 0, 1, 0, 1), New Taglunarcal (42, 0, 1, 4, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1) New Taglunarcal (31, 0, 2, 9, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0), NEW TAGLunarcal (21, 2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1), / * 93 * / New Taglunarcal (39, 0, 5, 20, 0, 1, 0, 1 , 0, 1, 1, 1), New Taglunarcal (28, 7, 6, 25, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1) , 0, 1, 1), New Taglunarcal (48, 0, 0, 30, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1), New Taglunarcal (37 , 0, 1, 35, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1), / * 97 * / new Taglunarcal (25, 5, 3, 41, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1), New Taglunarcal (44, 0, 4, 46, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1), New Taglunarcal (33, 0, 5, 51, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1), new taglunarcal (22, 4, 6, 56, 1 , 0, 1, 1, 0, 1, 0), / * 101 * / New Taglunarcal (40, 0, 1, 2, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0), New Taglunarcal (30, 9, 2, 7, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1), New Taglunarcal (49, 0, 3, 12, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1), new taglunarcal (38, 0, 4, 17, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0), / * 105 * / New Taglunarcal (27, 6, 6, 23, 0 , 1, 0, 1, 0, 0, 1, 0, 1, 1), New Taglunarcal (46, 0, 0, 28, 0, 1, 0, 1, 0, 0, 1 , 0, 1, 0, 1, 1, 0), New Taglunarcal (35, 0, 1, 33, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 NEW TAGLunarcal (24, 4, 2, 38, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0,
1, 0, 1), / * 109 * / New Taglunarcal (42, 0, 4, 44, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1), New Taglunarcal (31, 0, 5, 49, 1, 0, 1, 0, 1, 1, 0), NEW TAGLunarcal (21, 2, 6, 54, 0 , 1, 0, 1, 0, 1, 0, 1), new taglunarcal (40, 0, 0, 59, 0, 1, 0, 0, 1, 0, 1) , 1, 0, 1, 1, 0, 1), / * 113 * / New Taglunarcal (28, 6, 2, 5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0), New Taglunarcal (47, 0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1), new taglunarcal (36, 0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1), New Taglunarcal (25, 5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0), / * 117 * / New Taglunarcal (43, 0, 0, 26, 1, 1, 0, 1, 0, 1, 0 , 1, 0, 0, 1, 0, 1), New Taglunarcal (32, 0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0) New Taglunarcal (22, 3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0)]; / * Number of days of the country * / Solarcal = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
/ * The annual number of days per month, the year and leap year * / solardays = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365, 396, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366, 397]; Animalidx = ["Horse", "Sheep", "Monkey", "Chicken", "Dog", "Pig" "," Rat "," cow "," tiger "," rabbit "," dragon "," snake "]; locationidx = [" South "," East "," North "," West "];
IF (Solaryear <= firstyear || Solaryear> Lastyear) Return 1;
SM = Solarmonth - 1; IF (SM <0 || SM> 11) Return 2; Leap = Getleap (Solaryear);
IF (SM == 1) D = Leap 28; ELSE D = Solarcal [SM];
IF (Solardate <1 || Solardate> D) Return 3;
Y = Solaryear - Firstyear; ACC = SolarDays [Leap * 14 SM] Solardate; KC = ACC Lunarcal [Y] .BasekAnchiH; Kan = KC% 10; ChiH = KC% 12; location = locationIDX [KC% 4] Age = kc% 60; IF (age <22) age = 22 - age; Else Age = 82 - age; animal = animalidx [chih];
IF (ACC <= Lunarcal [Y] .BaseDays) {y -; lunaryear = Solaryear - 1; Leap = getleap (Lunaryear); SM = 12; ACC = SolarDays [Leap * 14 SM] Solardate;} else Lunaryear = Solaryear; L1 = Lunarcal [Y] .BaseDays; for (i = 0; i <13; i ) {l2 = l1 lunarcal [y] .MONTHDAYS [I] 29; IF (ACC <= L2) BREAK ; L1 = L2;}
Lunarmonth = i 1; Lunardate = ACC - L1; IM = Lunarcal [Y] .intercalation;
IF (im! = 0 && lunarmonth> IM) {lunarmonth-; if (lunarmonth == im) lunarmonth = -im;}
IF (Lunarmonth> 12) Lunarmonth - = 12; Today = New Date (); functioniniTARRAY () {this.Length = INITARRAY.ARGUMENTS.LENGTH FOR (VAR i = 0; I
"); Return 0;}
/ * Ask for the year of this Republic of China, return 0 is the year, 1 is a leap year * / function getleap (year) {if (Year% 400 == 0) Return 1; Else IF (Year% 100 == 0) Return 0 ELSE IF (Year% 4 == 0) Return 1; Else Return 0;}
Function Taglunarcal (D, I, W, K, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13) {this.basedays = D; / * to the Republic of China January 1 day to the number of days to the first month of the Lunar New Year * / this.Intercalation = i; / * 月 月 份. 0 == There is no juery in this year * / this.baseweekday = W; / * This year, the Republic of China is a day Reduce 1 * / this.basekanchih = k; / * This year, the Republic of China has reduced by 1 * / this.monthdays = [M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, m13]; / * This lunar month size, 0 == Xiaoyue (29th), 1 == Dali (30th) * /} // ->
Calconv ();