Traditional Culture Encyclopedia - The 24 Solar Terms - How to convert solar calendar into lunar calendar in asp
How to convert solar calendar into lunar calendar in asp
& ltbody & gt
& lt scripting language = JScript Runat = Server & gt
/*****************************************************************************
Date information
*****************************************************************************/
Var lunarInfo = new array (
0x04bd8,0x04ae0,0570,0x054d5,0x0d260,0x0d950,0x 16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,05b6,04d0,0x0d250,0x 1d255,0x0b540,0x0d6a0,0da2,0x095b0,0x 14977,
0x04970,04b0,0x0b4b5,0x06a50,0x06d40,0x 1ab54,0x02b60,0x09570,0x052f2,0x04970,
0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x 186e3,0x092e0,0x 1c8d7,0x0c950,
0x0d4a0,0x 1d8a6,0x0b550,0x056a0,0x 1a5b4,0x025d0,0x092d0,0x0d2b2,0950,0x0b557,
0x06ca0,0x0b550,0x 15355,0x04da0,05d0,0x 14573,0x052d0,09a8,0x0e950,0x06aa0,
0ea6,0b50,0x04b60,0ae4,0570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,
0x096d0,0x04dd5,0x04ad0,04d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b5a0,0x 195a6,
0x095b0,0x049b0,0974,04b0,0x0b27a,0x06a50,0x06d40,0f46,0b60,0x09570,
0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0b60,0x096d5,0x092e0,
0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0bb7,0x025d0,0x092d0,0x0cab5,
0950,0x0b4a0,0x 0ba 4,0d50,0x055d9,0x04ba0,05b0,0x 15 176,0x052b0,0930,
0x07954,0x06aa0,0d50,0x05b52,0x04b60,06e6,04e0,0x0d260,0x0ea65,0x0d530,
0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,04d0,0x 1d0b6,0x0d250,0x0d520,0x0dd45,
0x0b5a0,0x056d0,0x055b2,0x049b0,0577,04b0,0a50,0x 1b255,0x06d20,0da 0);
var solar month = new Array(3 1,28,3 1,30,3 1,30,3 1,30,3 1,30,3 1);
Var Gan = new array ("A", "B", "C", "D", "E", "Ji", "Geng", "Xin", "Man" and "Ghost");
Var Zhi = new array ("Zi", "Ugly", "Yin", "Mao", "Chen", "Si", "Wu", "Wei", "Shen", "You", "Xu" and "Hai");
Var Animals = new array ("mouse", "cow", "tiger", "rabbit", "dragon", "snake", "horse", "sheep", "monkey", "chicken", "dog" and "pig");
Var solarTerm = new array ("slight cold", "severe cold", "beginning of spring", "rain", "fright", "vernal equinox", "Qingming", "Grain Rain", "long summer", "small full", "awn seed", "summer solstice" and "slight summer heat".
var sTermInfo = new Array(0,2 1208,42467,63836,85337, 1070 14, 128867, 15092 1, 173 149, 1955565438
Var nStr 1 = new array ('days',' one',' two',' three',' four',' five',' six',' seven',' eight',' nine' and' ten');
Var nStr2 = new array ('early',' ten',' 20',' 30','');
Var monthName = new array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November" and "December");
//National holidays * refers to holidays.
Var sFtv = new array (
0 10 1* new year's day,
02 14 valentine's day,
0303 my birthday,
0308 Women's Day,
03 12 Arbor Day,
03 15 consumer rights day,
03 17 St. Patrick,
040 1 April fool's day,
050 1 labor day,
0504 Youth Day,
05 12 nurses' day,
"05 12 Yin Birthday",
060 1 Children's Day,
"06 14 flag selling day",
"070 1 Commemorating Hong Kong's Return to the Founding of the Party",
"0703 Huang Yan Online Birthday",
07 18 top's birthday,
080 1 Army Day,
Father's Day 0808,
0909 Mao Zedong Death Memorial Hall,
09 10 teacher's day,
"0928 Confucius' birthday",
100 1* National Day,
1006 festival for the elderly,
"1024 United Nations Day",
"1111veterans/memorial day",
1 1 12 Sun Yat-sen's birthday commemoration,
"1220 to commemorate the return of Macao",
1225 Christmas,
"1226 Mao Zedong birthday commemoration");
//Lunar Festival * means a holiday.
Var lFtv = new array (
"0 10 1* Spring Festival",
0 1 15 Lantern Festival,
0505 Dragon Boat Festival,
"0707 Qixi Valentine's Day",
"07 15 mid-autumn festival",
"08 15 Mid-Autumn Festival",
0909 Double Ninth Festival,
1208 Laba Festival,
"1224 off-year",
"0 100* New Year's Eve");
//What day is a month?
Var wFtv = new array (
"0 13 1 Martin Luther king day",
023 1 President's Day,
"0520 Mother's Day",
"0530 Armed Forces Day",
053 1 Victoria Day,
07 16 cooperation festival,
"0730 enslaved country week",
08 1 1 public holiday,
09 1 1 labor holiday,
102 1 Columbus Day,
"1 144 Thanksgiving");
/*****************************************************************************
Date calculation
*****************************************************************************/
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Returns the total number of days in the Y year of the lunar calendar.
Function delay time (y) {
var i,sum = 348
for(I = 0x 8000; I & gt0x8 I>> =1) sum+= (lunarinfo [y-1900] & Me)? 1: 0 ;
return(sum+leap days(y));
}
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Returns the number of days in a leap month in Y year of the lunar calendar.
Function leapDays(y) {
if(leap month(y))return((lunar info[y- 1900]& amp; 0x 10000)? 30: 29)
Otherwise return (0)
}
//= = = = = = = = = = = = = = = = = = = = = = = = = Returns the month of the lunar leap year Y, that is, 1- 12, or 0 if there is no leap year.
Function leapMonth(y) {
return(lunar info[y- 1900]& amp; 0xf)
}
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Returns the total number of days in M months of the lunar year Y.
Function Months (y, m) {
return((lunar info[y- 1900]& amp; (0x 10000 & gt; & gtm))? 30: 29 )
}
//= = = = = = = = = = = = = = = = = = = = = = = = Returns the number of days in the calendar year m+ 1 month.
Function solarDays(y, m) (
if(m== 1){
return((y % 4 = = 0)& amp; & amp(y% 100! = 0) || (y%400 == 0))? 29: 28);
} Otherwise {
return(solar month[m]);
}
}
//= = = = = = = = = = = = = = = = = = = = = = = The incoming offset returns to the main branch, and 0= Jiazi.
Cyclic Function (Quantity) (
return(Gan[num % 10]+Zhi[num % 12]);
}
//= = = = = = = = = = = = = = = = = = = = = Calculate the lunar calendar, pass in the date object, and return the lunar date object.
//The property of this object is .year.month.day.islam.yearcyl.daycyl.moncyl.
Function lunar (objdate) (
var i,leap=0,temp = 0;
Var baseDate = new date (1900,0,31);
var offset =(obj date-baseDate)/86400000;
this . day cyl = offset+40;
this . moncyl = 14;
for(I = 1900; I & lt2050 & amp& ampoffset & gt0; i++) {
temp = lYearDays(I);
offset-= temp;
this . moncyl+= 12;
}
if(offset & lt; 0) {
offset+= temp;
I-;
this . moncyl-= 12;
}
this . year = I;
this . year cyl = I- 1864;
leap = leap month(I); //What month is the leap month?
this.isLeap = false
for(I = 1; I< 13. & ampoffset & gt0; i++) {
//leap month
if(leap & gt; 0 & amp& ampI = =(leap+ 1)& amp; & ampthis.isLeap==false){
-Me;
this.isLeap = true
temp = leap days(this . year);
} Otherwise {
temp = monthDays(this.year,I);
}
//mention leap month
if(this . is leap = = true & amp; & ampI = =(leap+ 1))this . is leap = false;
offset-= temp;
if(this . is leap = = false)this . moncyl++;
}
if(offset = = 0 & amp; & ampleap & gt0 & amp& ampi==leap+ 1){
If (this. islap) {
this.isLeap = false
} Otherwise {
this.isLeap = true
-Me;
-this . moncyl;
}
}
if(offset & lt; 0){
offset+= temp;
-Me;
-this . moncyl;
}
this . month = I;
this . day = offset+ 1;
}
& lt/SCRIPT & gt;
& lt scripting language = JScript Runat = Server & gt
//Test code
var TT Date = new Date();
Var tt 1 = lunar calendar (ttdate);
Response. Write ('Gregorian calendar date:' +ttdate+'
Response. Write ('year:' +tt 1.year+'
Response. Write ('month:' +tt 1.month+'
Response. Write ('day:'+tt 1.day+'
Response. Write ('main branch displacement:' +tt 1.yearcyl+'
Response. Write ('trunk displacement' +tt 1.yearCyl+' trunk:'+cycle (TT 1. year cyl)+'+ animal [(tt 1.year-4)% 12.' br & gt');
Response. Write ('Lunar New Year' +tt 1.year+' Total days in a year:'+ly ear days (TT1.year)+'< br >' );
Response. Write ('Lunar New Year' +tt 1.year+' leap month days:'+leap day (TT1.year)+'< br >' );
Response. Write ('Lunar calendar' +tt 1.year+' What month is the leap year:'+leap month (TT 1.year)+'
& lt/SCRIPT & gt;
& lt/body & gt;
& lt/html & gt;
- Previous article:When does autumn begin?
- Next article:How to pinch the low-carbon life and environmental protection colored mud?
- Related articles
- What is the nickname of winter solstice?
- Shaanxi boys use fake running brothers to make online class avatars. Why did this boy set up such an avatar?
- Twenty-four solar terms countries
- Radio manuscript writing
- How to make posters for primary school students? How to draw posters for primary school students
- Physical farmer's calendar: It's fun to take a walk on the solstice in summer when Mang takes a nap.
- What should I do if the throttle idling is unstable after cleaning by Citroen Picasso?
- Good qi and blood, good health. The three "blood-enriching and blood-nourishing points" were all taught by the master of traditional Chinese medicine!
- Which of the following solar terms is the slowest revolution speed of the earth?
- What are the customs of rain?