农历时间日期代码

合集下载

C 万年历及公历农历转换源代码1

C  万年历及公历农历转换源代码1

scanf("%d.%d.%d",&gyear,&gmonth,&gday); if(gyear%4==0 && gyear%100!=0 || gyear%400==0) months[2]=29; else months[2]=28; /*以下是计算在该公历年的第几天*/
whatday=gPastday[gmonth]+gday; if((gyear%4==0 && gyear%100!=0 || gyear%400==0) && (gmonth>2)) whatday++; /*上如果是闰年和月份大于二则在该公历年的第几天数+1*/ /*计算该年春节在公历年的第几天*/
clrscr();
}
}
getch();
}
/*公历每月前面的天数*/ const int gPastday[13]={0,0,31,59,90,120,151,181,212,243,273,304,334};
months[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
{case 1:printf("
* 1 * "); break;
case 3:printf("
* 3 * "); break;
case 5:printf("
* 5 * "); break;
case 7:printf("
* 7 * "); break;
case 9:printf("
* 9 * ");break;
{

带农历的日期代码

带农历的日期代码
if ((yyyy > 1901) && (CnDateofDate(new Date((yyyy - 1)+"/12/31")) < 0)){
ResultMonth = - CnMonth[0];}
else {ResultMonth = CnMonth[0];}
ResultDay = CnBeginDay + DaysCount;
var Dizhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
return Tiangan[YYYY%10]+Dizhi[YYYY%12];
}
function CnDateofDateStr(DateGL){
if(CnMonthofDate(DateGL)=="零月") return "请调整您的计算机日期!";
0x87,0x6a,0x57,0x04,0x12,0x75,0x2b,0x00,0x1d,0xb6,0x95,0x00,0x8a,0xad,0x55,0x02,
0x15,0x55,0xaa,0x00,0x82,0x55,0x6c,0x07,0x0d,0xc9,0x76,0x00,0x17,0x64,0xb7,0x00,
CnDaysCount+= CnMonthDays[I];
I++;
}

用C语言编写万年历,详细代码

用C语言编写万年历,详细代码
printf("\nDo you want to continue to print(Y/N)?");
fflush(stdin);
scanf("%c",&ch);
if(ch=='N'||ch=='n')
break;
}
break;
case 4:
fflush(stdin);
printf("Are you sure?(Y/N)");
char* week[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int leap (int year)//判断闰年
{
if(year%4==0&&year%100!=0||year%400==0)
printf(" Sun Mon Tue Wed Thu Fri Sat \n**************");
if(a==7)
{
for(i=1;i<=b;i++)
{
printf("%4d",i);
if(i%7==0)
{
printf("**************\n**************");
}
for(i=1;i<=b;i++)
{
printf("%4d",i);
if(i==7*k-a)

公历和农历转换的JS代码

公历和农历转换的JS代码

公历和农历转换的JS代码<!--function CalConv(M){FIRSTYEAR = 1936;LASTYEAR = 2031;LunarCal = [new tagLunarCal(23, 3, 2, 17, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0 ), /* 1936 */new tagLunarCal( 41, 0, 4, 23, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ),new tagLunarCal( 30, 7, 5, 28, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ),new tagLunarCal( 49, 0, 6, 33, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),new tagLunarCal( 38, 0, 0, 38, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ), /* 1940 */new tagLunarCal( 26, 6, 2, 44, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),new tagLunarCal( 45, 0, 3, 49, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 35, 0, 4, 54, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 24, 4, 5, 59, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 1944 */new tagLunarCal( 43, 0, 0, 5, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1 ),new tagLunarCal( 32, 0, 1, 10, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1 ),new tagLunarCal( 21, 2, 2, 15, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ),new tagLunarCal( 40, 0, 3, 20, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ), /* 1948 */new tagLunarCal( 28, 7, 5, 26, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 47, 0, 6, 31, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 36, 0, 0, 36, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 26, 5, 1, 41, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ), /* 1952 */new tagLunarCal( 44, 0, 3, 47, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 33, 0, 4, 52, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 ),new tagLunarCal( 23, 3, 5, 57, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ),new tagLunarCal( 42, 0, 6, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1 ), /* 1956 */new tagLunarCal( 30, 8, 1, 8, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 48, 0, 2, 13, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 38, 0, 3, 18, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 27, 6, 4, 23, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0 ), /* 1960 */new tagLunarCal( 45, 0, 6, 29, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 35, 0, 0, 34, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ),new tagLunarCal( 24, 4, 1, 39, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ),new tagLunarCal( 43, 0, 2, 44, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ), /* 1964 */new tagLunarCal( 32, 0, 4, 50, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),new tagLunarCal( 20, 3, 5, 55, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ),new tagLunarCal( 39, 0, 6, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 29, 7, 0, 5, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 1968 */new tagLunarCal( 47, 0, 2, 11, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 36, 0, 3, 16, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0 ),new tagLunarCal( 26, 5, 4, 21, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1 ),new tagLunarCal( 45, 0, 5, 26, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 1972 */new tagLunarCal( 33, 0, 0, 32, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1 ),new tagLunarCal( 22, 4, 1, 37, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ),new tagLunarCal( 41, 0, 2, 42, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1 ),new tagLunarCal( 30, 8, 3, 47, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ), /* 1976 */new tagLunarCal( 48, 0, 5, 53, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1 ),new tagLunarCal( 37, 0, 6, 58, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 ),new tagLunarCal( 27, 6, 0, 3, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0 ),new tagLunarCal( 46, 0, 1, 8, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0 ), /* 1980 */new tagLunarCal( 35, 0, 3, 14, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1 ),new tagLunarCal( 24, 4, 4, 19, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1 ),new tagLunarCal( 43, 0, 5, 24, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1 ),new tagLunarCal( 32, 10, 6, 29, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1 ), /* 1984 */new tagLunarCal( 50, 0, 1, 35, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),new tagLunarCal( 39, 0, 2, 40, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1 ),new tagLunarCal( 28, 6, 3, 45, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0 ),new tagLunarCal( 47, 0, 4, 50, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 1988 */new tagLunarCal( 36, 0, 6, 56, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0 ),new tagLunarCal( 26, 5, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1 ),new tagLunarCal( 45, 0, 1, 6, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0 ),new tagLunarCal( 34, 0, 2, 11, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0 ), /* 1992 */new tagLunarCal( 22, 3, 4, 17, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),new tagLunarCal( 40, 0, 5, 22, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 ),new tagLunarCal( 30, 8, 6, 27, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1 ),new tagLunarCal( 49, 0, 0, 32, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1 ), /* 1996 */new tagLunarCal( 37, 0, 2, 38, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ),new tagLunarCal( 27, 5, 3, 43, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1 ),new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 1999 */new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1 ), /* 2000 */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, 1, 0 ),new tagLunarCal( 21, 2, 3, 14, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 ), /* 2004 */new tagLunarCal( 39, 0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 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, 0, 1, 0, 1, 1, 0, 1, 1 ), /* 2008 */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, 1, 0, 1, 0, 1, 0 ), /* 2012 */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 ), /* 2016 */new tagLunarCal( 27, 6, 6, 23, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 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 ), /* 2020 */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, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1 ),new tagLunarCal( 40, 0, 0, 59, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1 ), /* 2024 */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 ), /* 2028 */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, 1, 0 ) ];/* 西曆年每⽉之⽇數 */SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];/* 西曆年每⽉之累積⽇數, 平年與閏年 */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 = ["⾺ ", "⽺ ", "猴 ", "雞 ", "狗 ", "豬 ", "⿏ ", "⽜ ", "虎 ", "兔 ", "⿓ ", "蛇 " ];LocationIdx = [ "南", "東", "北", "西" ];if (M==0) { //阳历到阴历if (!IsInteger(form_jisuan.yyear.value) || !IsInteger(form_jisuan.ymonth.value) || !IsInteger(form_jisuan.yday.value)) return alert("请输⼊合法阳历年⽉⽇数值"); SolarYear = parseInt(form_jisuan.yyear.value);SolarMonth = parseInt(form_jisuan.ymonth.value);SolarDate = parseInt(form_jisuan.yday.value);if ( SolarYear <= FIRSTYEAR || SolarYear > LASTYEAR ) return alert("请输⼊1936-2031有效年份");sm = SolarMonth - 1;if ( sm < 0 || sm > 11 ) return alert("请输⼊有效⽉份");leap = GetLeap( SolarYear );if ( sm == 1 )d = leap + 28;elsed = 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;elseAge = 82 - Age;Age =Age + 3;if (Age < 10)Age=Age+60;Animal = AnimalIdx[ Chih ];if ( acc <= LunarCal[y].BaseDays ) {y--;LunarYear = SolarYear - 1;leap = GetLeap( LunarYear );sm += 12;acc = SolarDays[leap*14 + sm] + SolarDate;}elseLunarYear = 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;//alert("农历/阴历⽇期为:"+ LunarYear + "年" + LunarMonth + "⽉" + LunarDate + "⽇" );var showgn = 0;showgn = "农历(阴历)⽇期为:"+ LunarYear + "年" + LunarMonth + "⽉" + LunarDate + "⽇";document.form_jisuan.g2n.value=showgn;//form_jisuan.yyear.value = "";//form_jisuan.ymonth.value = "";//form_jisuan.yday.value = "";return 0;}else/* 阴历转阳历 */{if (!IsInteger(form_jisuan.nyear.value) || !IsInteger(form_jisuan.nmonth.value) || !IsInteger(form_jisuan.nday.value)) return alert("请输⼊合法农历年⽉⽇数值"); LunarYear = parseInt(form_jisuan.nyear.value);LunarMonth = parseInt(form_jisuan.nmonth.value);LunarDate = parseInt(form_jisuan.nday.value);if ( LunarYear < FIRSTYEAR || LunarYear >= LASTYEAR ) return alert("请输⼊1936-2031有效年份");y = LunarYear - FIRSTYEAR ;im = LunarCal[y].Intercalation;lm = LunarMonth;if ( lm < 0 ){if ( lm != -im )return alert("请输⼊有效⽉份");}else if ( lm < 1 || lm > 12 ) return alert("请输⼊有效⽉份");if ( im != 0 ){if ( lm > im )lm++;else if ( lm == -im )lm = im + 1;}lm--;if ( LunarDate > LunarCal[y].MonthDays[lm] + 29 )return alert("农历⽇期不正确");acc = 0;for ( i=0; i < lm;i++) {acc+= LunarCal[y].MonthDays[i] + 29;}acc +=LunarCal[y].BaseDays + LunarDate;leap = GetLeap( LunarYear );for ( i=13; i>=0; i-- ) {if ( acc > SolarDays[leap*14+i] )break;}SolarDate = acc - SolarDays[leap*14 + i] ;if ( i <= 11 ){SolarYear = LunarYear;SolarMonth = i + 1;}else{SolarYear = LunarYear + 1;SolarMonth = i - 11;}leap = GetLeap( SolarYear );y = SolarYear - FIRSTYEAR;//acc = SolarDays[leap][SolarMonth-1] + SolarDate;acc = SolarDays[leap*14 + SolarMonth-1] + SolarDate;weekday = ( acc + LunarCal[y].BaseWeekday ) % 7;kc = acc + LunarCal[y].BaseKanChih;kan = kc % 10;chih = kc % 12;//alert("公历/阳历⽇期为:"+ SolarYear + "年" + SolarMonth + "⽉" + SolarDate + "⽇" );var showng = 0;showng = "公历(阳历)⽇期为:"+ SolarYear + "年" + SolarMonth + "⽉" + SolarDate + "⽇";document.form_jisuan.n2g.value=showng;//form_jisuan.nyear.value = "";//form_jisuan.nmonth.value = "";//form_jisuan.nday.value = "";return 0;}//else结束}/* 闰年, 返回 0 平年, 1 闰年 */function GetLeap( year ){if ( year % 400 == 0 )return 1;else if ( year % 100 == 0 )return 0;else if ( year % 4 == 0 )return 1;elsereturn 0;}function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {this.BaseDays = d; /* 1 ⽉ 1 ⽇到正⽉初⼀的累计⽇ */this.Intercalation = i; /* 闰⽉⽉份. 0==此年沒有闰⽉ */this.BaseWeekday = w; /* 此年 1 ⽉ 1 ⽇为星期减 1 */this.BaseKanChih = k; /* 此年 1 ⽉ 1 ⽇之⼲⽀序号减 1 */this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此农历年每⽉之⼤⼩, 0==⼩⽉(29⽇), 1==⼤⽉(30⽇) */}//--><!--function OpenWin( url ) {return window.open( url, 'coop', 'width=320,height=350,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=1' );}function IsInteger(string ,sign){var integer;if ((sign!=null) && (sign!='-') && (sign!='+')){alert('IsInter(string,sign)的参数出错:nsign为null或"-"或"+"');return false;}integer = parseInt(string);if (isNaN(integer)){return false;}else if (integer.toString().length==string.length){if ((sign==null) || (sign=='-' && integer<0) || (sign=='+' && integer>0)){return true;}elsereturn false;}elsereturn false;}//-->调⽤⽅式:<label>请选择阳历⽇期</label><select size="1" name="yyear" class="select"><option value="1937">1937</option><option value="1938">1938</option><option value="1939">1939</option><option value="1940">1940</option><option value="1941">1941</option><option value="1942">1942</option><option <select size="1" name="ymonth" class="select"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</ <select size="1" name="yday" class="select"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</<input onclick="CalConv(0)" class="button" type="button" value="阳历转阴历">。

python生日提醒_Python实现农历生日提醒功能

python生日提醒_Python实现农历生日提醒功能

python生日提醒_Python实现农历生日提醒功能农历生日提醒是一种非常实用的功能,能够帮助我们记住家人和朋友的农历生日,并在特定日期提醒我们发送祝福或者准备礼物。

在这篇文章中,我将使用Python来实现农历生日提醒功能。

``````安装完成后,我们可以开始编写代码了。

首先,我们需要引入需要的库:```pythonimport tkinter as tkfrom lunarcalendar import Converter, Solar```接下来,我们需要定义一个函数来获取当前的农历日期:```pythondef get_lunar_date(:solar = Solar(today.year, today.month, today.day)lunar = Converter(.solar_to_lunar(solar)return lunar```接下来,我们需要定义一个函数来检查是否有农历生日需要提醒,并在有生日需要提醒时弹出一个消息框:```pythondef check_birthday(:lunar_date = get_lunar_datelunar_month = lunar_date.monthlunar_day = lunar_date.dayif (lunar_month, lunar_day) in birthday_dict:name = birthday_dict[(lunar_month, lunar_day)]message = f"今天是{name}的农历生日!"tk.messagebox.showinfo("生日提醒", message)```在该函数中,我们首先获取当前的农历日期。

然后,我们使用获取的农历日期作为键来查找生日字典birthday_dict中是否有对应的生日。

接下来,我们需要定义一个函数来添加生日信息到生日字典:```pythondef add_birthday(:name = name_entry.getdate = date_entry.getlunar_date = Converter(.solar_to_lunar(Solar(lunar_date.year, lunar_date.month, lunar_date.day))birthday_dict[(lunar_date.month, lunar_date.day)] = namename_entry.delete(0, tk.END)date_entry.delete(0, tk.END)```在该函数中,我们首先从输入框中获取生日人的姓名和农历日期。

C语言万年历代码

C语言万年历代码
printf(" ");
}
for(a=1;a<=30;a++)
{
c++;
if(c%7-1==0&&c!=1)
printf("\n");
{
c++;
printf(" ");
}
for(a=1;a<=_m;a++)
{
c++;
if(c%7-1==0&&c!=1)
} Βιβλιοθήκη else { c=0;
printf("┈━═☆ ┈━═☆ ┈━═☆ \n");
printf(" ◇ %d月 ◇ \n",yue);
printf("============================\n");
{
c=0;
printf("\n");
printf("┈━═☆ ┈━═☆ ┈━═☆ \n");
printf(" ◇ %d月 ◇ \n",yue);
printf("============================\n");
printf(" 日 一 二 三 四 五 六\n");
if(yue==4||yue==6||yue==9||yue==11||yue==2)
{
if(yue==2)
{
c=0;
printf("┈━═☆ ┈━═☆ ┈━═☆ \n");

日历实现vb代码

日历实现vb代码

日历实现vb代码Dim tian, di As StringDim cyear, cmonth, cday As Integer Dim year1, month1, day1 As Integer Dim n, k, i, j As IntegerDim total As LongDim date1, date2 As DateDim IsendAs BooleanDim st As StringDim data(100) As StringDim yueDim temp As IntegerPrivate Sub Combo2_click()year1 = Val(Combo2.Text)month1 = Val(Combo1.Text)day1 = 1Isend = Falsek = 0n = 0x = cal()Label2.Caption = disp2()Label3.Caption = f()Label4.Caption = redisp()End SubPrivate Sub Combo1_click()year1 = Val(Combo2.Text)month1 = Val(Combo1.Text)day1 = 1Isend = Falsek = 0n = 0x = cal()Picture1.ClsPicture1.Print redisp()Label2.Caption = disp2()End SubPrivate Sub Form_Initialize()'以字符串形式统计农历信息,data(0) = "101001001011" data(1) = "51011001001011" data(2) = "011010100101" data(3) = "011011010100" data(4) = "41010110110101" data(5) = "001010110110" data(6) = "100101010111" data(7) = "20100100101111" data(8) = "010*********" data(9) = "60110010010110" data(10) = "110101001010" data(11) = "111010100101" data(12) = "50110110101001" data(13) = "010*********" data(14) = "001010110110" data(15) = "31001001101110" data(16) = "100100101110" data(17) = "71100100101101" data(18) = "110010010101" data(19) = "110101001010" data(20) = "61101101001010" data(21) = "101101010101" data(22) = "010*********" data(23) = "41010101011011" data(24) = "001001011101" data(25) = "100100101101" data(26) = "21100100101011" data(27) = "101010010101" data(28) = "71011010010101" data(29) = "011011001010" data(30) = "101101010101" data(31) = "50101010110101" data(32) = "010*********" data(33) = "101001011011" data(34) = "30101001010111" data(35) = "010*********" data(36) = "81010100101010" data(37) = "111010010101" data(38) = "011010101010" data(39) = "61010110101010"data(41) = "010*********" data(42) = "41010010101110" data(43) = "101001010111" data(44) = "010*********" data(45) ="31110100100110" data(46) = "110110010101" data(47) = "70101101010101" data(48) = "010*********" data(49) = "100101101101" data(50) = "50100101011101" data(51) = "010*********" data(52) = "101001001101" data(53) = "41101001001101" data(54) = "110100100101" data(55) = "81101010100101" data(56) = "101101010100" data(57) = "101101101010" data(58) = "61001011011010" data(59) = "100101011011" data(60) = "010*********" data(61) = "41010010010111" data(62) = "101001001011" data(63) = "A1011001001011" data(64) = "011010100101" data(65) = "011011010100" data(66) = "61010110110100" data(67) = "101010110110" data(68) = "100101010111" data(69) = "50100100101111" data(70) = "010*********" data(71) = "011001001011" data(72) = "30110101001010" data(73) = "111010100101" data(74) = "80110101100101" data(75) = "010*********" data(76) = "101010110110" data(77) = "51001001101101" data(78) = "100100101110" data(79) = "110010010110" data(80) = "41101010010101" data(81) = "110101001010" data(82) = "110110100101" data(83) = "20101101010101"data(85) = "71010101011011"data(86) = "001001011101"data(87) = "100100101101"data(88) = "51100100101011"data(89) = "101010010101"data(90) = "101101001010"data(91) = "41011010101010"data(92) = "101011010101"data(93) = "90101010110101"data(94) = "010*********"data(95) = "101001011011"data(96) = "60101001010111"data(97) = "010*********"data(98) = "101010010011"data(99) = "40111010010101"year1 = Year(Now)month1 = Month(Now)day1 = Day(Now)x = calLabel1.Caption = disp3()End SubPrivate Sub Form_Load()For j = 0 To 11Combo1.List(j) = j + 1Next jFor i = 0 To 99Combo2.List(i) = i + 1921Next iCombo1.T ext = Combo1.List(Month(Now) - 1) Combo2.Text = Combo2.List(Year(Now) - 1921) tian = "甲乙丙丁戊己庚辛壬癸"di = "子丑寅卯辰巳午未申酉戌亥"Isend = Falsek = 0n = 0year1 = Year(Now)month1 = Month(Now)day1 = 1x = calLabel2.Caption = disp2() '天干地支纪年Form1.ShowPicture1.Print redisp() '显示农历阳历在图片框上Label5.Caption = Year(Now) & "年" & Month(Now) & "月" & Day(Now) & "日"End SubFunction disp1() As String '以汉字形式显示农历信息ri1 = "初一初二初三初四初五初六初七初八初九初十十一十二十三十四十五十六十七十八十九廿十廿一廿二廿三廿四廿五廿六廿七廿八廿九三十"yue = Array("一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊")st = ""st = st + Mid(ri1, 2 * cday - 1, 2)If cday = 1 ThenIf cmonth< 0 Thenst = "闰" &yue(-cmonth - 1)Elsest = yue(cmonth - 1) & "月"End IfEnd Ifdisp1 = stEnd FunctionFunction disp2() As String '天干地支纪年法Dim tmp As Stringtmp = ""tmp = Mid(tian, ((Year(Now) - 4) Mod 10) + 1, 1) + Mid(di, ((Year(Now) - 4) Mod 12) + 1, 1) & "年" disp2 = tmpEnd FunctionFunction disp3() As String '把农历信息以汉字的形式输出ri1 = "初一初二初三初四初五初六初七初八初九初十十一十二十三十四十五十六十七十八十九廿十廿一廿二廿三廿四廿五廿六廿七廿八廿九三十"yue = Array("一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊")If cmonth< 0 Thenst = "闰" &yue(-cmonth - 1) & "月"Elsest = yue(cmonth - 1) & "月"End Ifst = st + Mid(ri1, 2 * cday - 1, 2)disp3 = stEnd FunctionFunction cal() As String '以1921年2月8日为基准点,计算阳历某一天对应的阴历k = 0: n = 0: total = 0date1 = DateSerial(year1, month1, day1)date2 = #2/8/1921#total = DateDiff("d", date2, date1) + 1Dot = data(k)n = IIf(Len(t) = 14, 2, 1)i = (2 * (n - 1) + 13)DoIf total <= 29 + Val(Mid(t, n, 1)) ThenIsend = TrueExit DoEnd Iftotal = total - 29 - Val(Mid(t, n, 1))n = n + 1temp = nIf (n = i) ThenEnd IfLoopIf (Isend = True) ThenExit DoEnd Ifk = k + 1Loopcyear = 1921 + kcmonth = ncday = totalIf Len(data(k)) = 14 ThenIf (cmonth>Val(Mid(data(k), 1, 1)) + 2) Thencmonth = cmonth - 2ElseIf cmonth = Val(Mid(data(k), 1, 1)) + 2 Thencmonth = 2 - cmonthElsecmonth = cmonth - 1End IfEnd IfEnd IfEnd FunctionFunction redisp() As String '把阳历和农历放到一块以字符串的形式的组合到一起redisp = " 日" + "一" + "二" + "三" + "四" + "五" + "六" + Chr(13) + Chr(13)date1 = DateSerial(year1, month1, day1)s = Weekday(date1)Dim a As IntegerFor i = 1 To s - 1redisp = redisp + Space(7)NextFor i = 1 To days(month1)Call addredisp = redisp + " " + Format(i, "!@@@@@") If a Mod 7 = 0 Andi< 8 Thenredisp = redisp + Chr(13)For j = 1 To s - 1redisp = redisp + Space(7)NextFor b = s To 7redisp = redisp + disp1() + " "cday = cday + 1Call addNext bredisp = redisp + Chr(13) + Chr(13)ElseIf (a Mod 7 = 0 Andi>= 8) Thenredisp = redisp + Chr(13)For j = i - 6 Toiredisp = redisp + disp1() + " "cday = cday + 1Call addNext jredisp = redisp + Chr(13) + Chr(13)End IfIf i = days(month1) And a <> 0 Thenredisp = redisp + Chr(13)For j = 1 To aredisp = redisp + disp1() + " "cday = cday + 1Call addNext jEnd Ifa = (a + 1) Mod 7NextEnd FunctionFunction days(month1) As Integer '判断阳历每个月的天数Select Case month1Case 1, 3, 5, 7, 8, 10, 12days = 31Case 4, 6, 9, 11days = 30Case 2If (year1 Mod 4 = 0 And year1 Mod 100 <> 0) Or (year1 Mod 400 = 0) Thendays = 29Elsedays = 28End IfEnd SelectEnd FunctionPrivate Sub Timer1_Timer() '调用系统时间,显示时分秒Label6.Caption = Format(Hour(Time) & ":" & Minute(Time) & ":" & Second(Time), "hh:mm:ss") End SubSub add() '农历的日期加一天之后的农历If Len(data(cyear - 1921)) = 12 ThenIf cday> 29 + Val(Mid(data(cyear - 1921), cmonth, 1)) Then cday = 1: cmonth = cmonth + 1If cmonth = 13 Then cmonth = 1: cyear = cyear + 1 End IfElseIfLen(data(cyear - 1921)) = 14 ThenSelect Case cmonthCase Is < 0If cday> 29 + Val(Mid(data(cyear - 1921), -cmonth + 2, 1)) Then cday = 1: cmonth = -cmonth + 1End IfCase Is <="" 1,="" 1921),="" bdsfid="281" p="">If cday> 29 + Val(Mid(data(cyear - 1921), cmonth + 1, 1)) Then cday = 1: cmonth = cmonth + 1End IfCase Is = V al(Mid(data(cyear - 1921), 1, 1))If cday> 29 + Val(Mid(data(cyear - 1921), cmonth + 1, 1)) Then cday = 1: cmonth = -cmonthEnd IfCase Is >Val(Mid(data(cyear - 1921), 1, 1))If cday> 29 + Val(Mid(data(cyear - 1921), cmonth + 2, 1)) Then cday = 1: cmonth = cmonth + 1End IfEnd SelectEnd IfEnd Sub。

C语言万年历(代码+说明)

C语言万年历(代码+说明)

/*本程序在Microsoft Visual Studio 2010 旗舰版中测试通过*/ #include "stdio.h"#include "stdlib.h"#include "time.h"#include "conio.h"#define KEYUP 72//宏定义键盘的键值(↑)#define KEYDOWN 80//宏定义键盘的键值(↓)#define KEYLEFT 75//宏定义键盘的键值(←)#define KEYRIGHT 77//宏定义键盘的键值(→)//函数声明部分const int isLeap(int year);const int getMonthDays(int year,int month);const int yearDays(int year);void printCalendar(int year,int month);void main(){int year,month;int action = 0;//获取本地当前的年份和月份time_t timep;struct tm *p;time(&timep);p = localtime(&timep);year = p->tm_year+1900;//获取本地当前的年份month = p->tm_mon + 1;//获取本地当前的月份while(1){printf("\t\t %d 年%d 月\n",year,month);printCalendar(year,month);action = getch();system("cls");switch(action){case KEYUP:year++;break;case KEYDOWN:year--;break;case KEYLEFT:month--;if(month < 1){month = 12;}break;case KEYRIGHT:month++;if(month > 12){month = 1;}break;}}}//判断year 是否是润年返回1 为闰年const int isLeap(int year){if(year%4==0&&year%100!=0||year%400==0){ return 1;}else{return 0;}}/*计算year 年的month 月是多少天*返回值:整型,天数*/const int getMonthDays(int year,int month){ switch(month){case 1:case 3:case 5:case 7:case 8:case 10:case 12:return 31;break;case 4:case 6:case 9:case 11:return 30;break;case 2:if(isLeap(year)){return 29;}else{return 28;}break;default:return 0;break;}}//计算year 年的天数const int yearDays(int year){if(isLeap(year)){return 366;}else{return 365;}}/*判断year 年month 月day 天时星期几*返回值:0,1,2,3,4,5,6*/const int isWeek(int year,int month,int day){ int days = 0;int i;//计算前year 年有多少天for(i=1;i<year;i++){days = days + yearDays(i);}//计算year 年的前month 个月有多少天for(i=1;i<month;i++){days = days + getMonthDays(year,i);}//从公元1 年days = days + day;return days%7;}//按日历的格式打印year 年month 月的日历void printCalendar(int year,int month){const char *week[]= {"日","一","二","三","四","五","六"};int i;int row = 0;for(i=0;i<7;i++){printf("%s\t",week[i]);}printf("\n");//判断year 年month 月1 日时星期几for(i=0;i<isWeek(year,month,1);i++){printf("\t");}for(i=0;i<getMonthDays(year,month);i++){ printf("%d\t",i+1);//如果是星期六就换行打印日期if(isWeek(year,month,i+1) == 6){row ++;if(row == 2){printf(" ↑");}if(row == 3){printf("←→");}if(row == 4){printf(" ↓");}printf("\n\n");}}printf("\n");}CreateDBW制作2012年12月7日。

C语言农历表算法

C语言农历表算法

#include<stdio.h>void DateTrans(char *chDate,int *nYear,int *nMonth,int *nDay);// 1int IsLeapYear(int nYear);// 2int GetWeekOfFirstday(int nYear);// 3int GetWeek(int nYear,int nMonth,int nDay,int nWeekOfFirstday);// 4void PrintCalendar(int nWeek,int nDay,int nMonthDays,char *chDate);// 5void DateTrans(char *chDate,int *nYear,int *nMonth,int *nDay)// 1{*nYear=(chDate[0]-'0')*1000+(chDate[1]-'0')*100+(chDate[2]-'0')*10+chDate[3] -'0';*nMonth=(chDate[5]-'0')*10+chDate[6]-'0';*nDay=(chDate[8]-'0')*10+chDate[9]-'0';}int IsLeapYear(int nYear)// 2{if(nYear%4==0)return 1;elsereturn 0;}int GetWeekOfFirstday(int nYear)// 3{if(nYear>2000)return ((nYear-2001)*365+(nYear-2001)/4+1)%7;else if(nYear<2000)return 6-((2000-nYear)*365+(2000-nYear)/4)%7;elsereturn 6;}int GetWeek(int nYear,int nMonth,int nDay,int nWeekOfFirstday)// 4{int nDaysYear[]={31,28,31,30,31,30,31,31,30,31,30,31};int nDaysLeapYear[]={31,29,31,30,31,30,31,31,30,31,30,31};int i,sum=0;if(nYear%4==0){for(i=0;i<(nMonth-1);i++){sum+=nDaysLeapYear[i];}return (sum+nDay+nWeekOfFirstday-1)%7;}else{for(i=0;i<(nMonth-1);i++){sum+=nDaysYear[i];}return (sum+nDay+nWeekOfFirstday-1)%7;}}void PrintCalendar(int nWeek,int nDay,int nMonthDays,char *chDate) // 5{int i,j;printf("the calender of this month as following:\n");printf("*********************************\n");printf(" SUN MON TUE WEN THU FRI STA\n");for(i=1,j=1;j<=nMonthDays;i++){if(i<=nWeek+1)printf(" ");else{printf("%4d",j);j++;}if(i%7==0)printf("\n");}printf("\n********************************\n");printf("OK!\n");}main(){char chDate[11],i=0,j,isleapyear;int nYear,nMonth,nDay;int nWeekOfFirstday;int nMonthDays;int nWeek;char *Week;int nDaysYear[]={31,28,31,30,31,30,31,31,30,31,30,31};int nDaysLeapYear[]={31,29,31,30,31,30,31,31,30,31,30,31};printf("请输入你要查找的日期,如(2001\\01\\01或2001.01.01:\n或者是你想要日历的月份:如(2000\\01或2000.01):\n");do{scanf("%c",&chDate[i]);i++;}while(chDate[i-1]!='\n');if(i==11)chDate[i-1]='\0';elsefor(j=8;j<11;j++)chDate[j]='0';DateTrans(chDate,&nYear,&nMonth,&nDay);// 1while(nYear<=0||nMonth<1||nMonth>12){printf("查询年月chDate非法\n");return 0;}nWeekOfFirstday = GetWeekOfFirstday(nYear);// 3nWeek=GetWeek(nYear,nMonth,nDay,nWeekOfFirstday);// 4isleapyear=IsLeapYear(nYear);// 2if(isleapyear==1)nMonthDays=nDaysLeapYear[nMonth-1];else if(isleapyear==0)nMonthDays=nDaysYear[nMonth-1];if(i==11){while(nDay<1||nDay>nMonthDays){printf("查询日期chDate非法\n");return 0;}switch(nWeek){case 0:Week="SUNDAY";break;case 1:Week="MONDAY";break;case 2:Week="TUESDAY";break;case 3:Week="WEDNESDAY";break;case 4:Week="THUESDAY";break;case 5:Week="FRIDAY";break;case 6:Week="SATERDAY";break;}printf("This day (%s) is %s\n",chDate,Week);printf("OK!\n");}elsePrintCalendar(nWeek,nDay,nMonthDays,chDate); //5 }。

万年历c语言编程代码

万年历c语言编程代码

#include <stdio.h>// 函数声明int is_leap_year(int year);int get_first_day_of_year(int year);// 主函数int main() {int year, month, first_day_of_year, first_day_of_month, days_in_month;int i, j, k;printf("请输入年份(例如:2022):");scanf("%d", &year);first_day_of_year = get_first_day_of_year(year);for (month = 1; month <= 12; month++) {printf("%d 年%d 月\n", year, month);printf("日一二三四五六\n");if (month == 2) {if (is_leap_year(year)) {days_in_month = 29;} else {days_in_month = 28;}} else if (month == 4 || month == 6 || month == 9 || month == 11) { days_in_month = 30;} else {days_in_month = 31;}first_day_of_month = (first_day_of_year + (month-1)*28)%7;for (i = 1; i <= first_day_of_month; i++) {printf(" ");}for (j = 1; j <= days_in_month; j++) {printf("%2d ", j);k = (i + j - 1) % 7;if (k == 0) {printf("\n");}}printf("\n");}}// 判断是否闰年int is_leap_year(int year) {return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);}// 计算年份第一天是星期几int get_first_day_of_year(int year) {int first_day = (year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400;first_day = (first_day + 1) % 7;return first_day;}这是一个简单的万年历示例代码,但它不是完整的代码。

万年历c语言代码讲解

万年历c语言代码讲解

万年历c语言代码讲解摘要:一、万年历C语言代码讲解简介1.万年历的概念及用途2.C语言代码讲解的重要性二、C语言代码基础1.C语言简介2.C语言基本语法3.C语言的数据类型与变量三、万年历C语言代码实现1.计算闰年2.计算月份的天数3.计算日期的星期4.输出万年历四、万年历C语言代码的优化与拓展1.代码性能优化2.功能的拓展与实现五、总结1.万年历C语言代码讲解的意义2.对编程能力的提升正文:一、万年历C语言代码讲解简介万年历是一种记录了公历日期的工具,它可以帮助我们快速查询公历日期对应的农历、节日、提醒等信息。

C语言是一种广泛应用于计算机领域的编程语言,掌握C语言编程对于学习其他编程语言有很大的帮助。

本文将详细讲解万年历C语言代码的实现过程,帮助读者更好地理解C语言编程。

二、C语言代码基础1.C语言简介C语言是一种高级编程语言,由丹尼斯·里奇(Dennis Ritchie)于20世纪70年代在贝尔实验室开发。

C语言具有良好的性能和可移植性,被广泛应用于操作系统、嵌入式系统、硬件驱动等领域。

2.C语言基本语法C语言的基本语法包括变量声明、数据类型、运算符、控制结构、函数等。

了解这些基本语法对于编写C语言代码至关重要。

3.C语言的数据类型与变量C语言的数据类型包括整型、浮点型、字符型等。

变量是存储数据的容器,通过变量名来表示。

声明变量时需要指定变量的数据类型和存储空间。

三、万年历C语言代码实现1.计算闰年闰年是指公历年份可以被4整除但不能被100整除的年份,或者是可以被400整除的年份。

通过编写一个函数,我们可以判断一个年份是否为闰年。

2.计算月份的天数根据公历规定,每个月的天数不同。

通过编写一个函数,我们可以计算指定月份的天数。

3.计算日期的星期通过编写一个函数,我们可以根据公历日期计算对应的星期。

4.输出万年历根据用户输入的日期范围,输出对应的万年历信息。

四、万年历C语言代码的优化与拓展1.代码性能优化在实现万年历C语言代码的过程中,可以通过优化算法、使用更高效的函数等方式提高代码性能。

公历转换成农历c语言函数

公历转换成农历c语言函数

公历转换成农历c语言函数在编程过程中,经常需要进行日期的转换操作。

其中,将公历转换成农历是一个常见的需求。

在C语言中,我们可以通过编写一个函数来实现这个功能。

下面是一个实现公历转换成农历的C语言函数的示例:```c#include <stdio.h>typedef struct {int year; // 公历年份int month; // 公历月份int day; // 公历日期} Date;typedef struct {int year; // 农历年份int month; // 农历月份int day; // 农历日期} LunarDate;// 公历转农历函数void convertToLunar(const Date* gregorianDate, LunarDate* lunarDate) {// 在这里编写公历转农历的具体实现代码// 具体实现略}int main() {Date gregorianDate = {2022, 10, 1}; // 示例:公历日期为2022年10月1日LunarDate lunarDate;convertToLunar(&gregorianDate, &lunarDate);printf("公历日期:%d年%d月%d日\n", gregorianDate.year, gregorianDate.month, gregorianDate.day);printf("农历日期:%d年%d月%d日\n", lunarDate.year, lunarDate.month, lunarDate.day);return 0;}```在上述代码中,我们首先定义了`Date`和`LunarDate`结构体,分别表示公历日期和农历日期。

`Date`结构体包含了年、月、日三个字段,而`LunarDate`结构体也包含了年、月、日三个字段。

自定义数字格式5——日期代码

自定义数字格式5——日期代码

⾃定义数字格式5——⽇期代码昨天我们说了⾃定义数字格式中的⽂本占位符和特殊代码,今天来说下有关⽇期的⼀些代码,你准备好了吗?-01-⽇期代码1.年份的代码下图是有关年份的代码,有2个,⼀个是yy,⼀个是yyyy。

yy是显⽰年份的后2位,结果为00到99;yyyy是将年份显⽰为4位数,结果是1900-9999。

这⾥的yyyy还可以⽤e来表⽰。

如下图所⽰,第1种yy只将年份的后2位显⽰出来,第2种yyyy将年份的4位全部显⽰出来,第3种e和yyyy⼀样,将年份的4位显⽰出来。

很简单,有⽊有。

2.⽉份的代码下图是⽉份的代码,有5个,分别是1个m,2个m,···5个m。

m是将⽉份显⽰为1,2,3,···,12,前⾯不带0;mm是将⽉份显⽰为01,02,···,12,前⾯带0;mmm将⽉份显⽰为英⽂缩写形式Jan,Feb,···,Dec;mmmm将⽉份显⽰为完整的英⽂单词January,February,···,December;mmmmm将⽉份显⽰为英⽂单词⾸字母J,F,···,D。

如下图所⽰,以2019/5/5为列说明,m显⽰5,mm显⽰05,mmm显⽰英⽂缩写前3个字母May,mmmm显⽰完整英⽂单词May,mmmmm显⽰英⽂单词⾸字母M。

其他也是⼀样的。

3.⽇的代码⽇的代码有4种,分别是1个d,2个d,3个d,4个d。

d将⽇显⽰为1到31,前⾯不带0;dd将⽇显⽰为01到31,根据需要在前⾯带0;ddd将⽇显⽰为英⽂周⼏的缩写形式Sun,Mon,···,Sat;dddd将⽇显⽰为完整的英⽂周⼏,Sunday,Monday,···,Saturday。

如下图所⽰,d前⾯不带0,dd根据需要会加0,⽐如第1个和第2个⽇期的天分别是5和8,会在它们前⾯加0,ddd将⽇显⽰为英⽂周⼏的缩写,dddd将⽇显⽰为完整的英⽂周⼏。

excel中农历国历的相互转换方法及代码

excel中农历国历的相互转换方法及代码

打开相应的excel表格,按Alt+F11打开VBA编辑器,点击插入—插入模块,将下面代码粘贴上去,点击保存后关闭该窗口。

接着在相应单元格调用下面四个函数即可实现相应的功能了。

适用于1901-2100年间=lunar("2006-11-1") 求阳历2006-11-1日对应的阴历=solar("2006-1-1") 求阴历2006年正月初一对应的阳历=lunarbirth("1975-5-6") 阴历生日:阳历1975年5月6日出生,今年阴历生日时对应的阳历日期=solarbirth("1975-5-6") 阳历生日:阳历1975年5月6日出生,今年阳历生日时对应的阳历日期1.'阴阳历转换和阴阳历生日2.'Version: 1.1 2005-9-13.'Author: James Zhuang4.'Lunar(SolarDate[, Part = 0 | 1 | 2 | 3]) 阳历转换成阴历5.' Part = 0, all; Part = 1, lunar year; Part = 2, lunarmonth; Part = 3, lunar day6.'Solar(LunarDate[, LunarMonth = 0 | 1]) 阴历转换成阳历7.Type ConvDataA8. leapmonth As Integer9. month(1 To 13) As Integer10. sp_month As Integer 'Solar month of Spring Festival11. sp_day As Integer 'Solar day of Spring Festival12.End Type13.Private Function LunarData(q_year) As ConvDataA14. Dim d As Long15. Dim month(1 To 13) As Integer16.'1901-210017.LunarCal = Array(&H4AE53, &HA5748, &H5526BD, &HD2650, &HD9544, &H46AAB9, &H56A4D,&H9AD42, &H24AEB6, &H4AE4A, _18.&H6A4DBE, &HA4D52, &HD2546, &H5D52BA, &HB544E, &HD6A43, &H296D37, &H95B4B,&H749BC1, &H49754, _19.&HA4B48, &H5B25BC, &H6A550, &H6D445, &H4ADAB8, &H2B64D, &H95742, &H2497B7,&H4974A, &H664B3E, _20.&HD4A51, &HEA546, &H56D4BA, &H5AD4E, &H2B644, &H393738, &H92E4B, &H7C96BF,&HC9553, &HD4A48, _21.&H6DA53B, &HB554F, &H56A45, &H4AADB9, &H25D4D, &H92D42, &H2C95B6, &HA954A,&H7B4ABD, &H6CA51, _22.&HB5546, &H555ABB, &H4DA4E, &HA5B43, &H352BB8, &H52B4C, &H8A953F, &HE9552,&H6AA48, &H7AD53C, _23.&HAB54F, &H4B645, &H4A5739, &HA574D, &H52642, &H3E9335, &HD9549, &H75AABE,&H56A51, &H96D46, _24.&H54AEBB, &H4AD4F, &HA4D43, &H4D26B7, &HD254B, &H8D52BF, &HB5452, &HB6A47,&H696D3C, &H95B50, _25.&H49B45, &H4A4BB9, &HA4B4D, &HAB25C2, &H6A554, &H6D449, &H6ADA3D, &HAB651,&H93746, &H5497BB, _26.&H4974F, &H64B44, &H36A537, &HEA54A, &H86B2BF, &H5AC53, &HAB647, &H5936BC,&H92E50, &HC9645, _27.&H4D4AB8, &HD4A4C, &HDA541, &H25AA36, &H56A49, &H7AADBD, &H25D52, &H92D47,&H5C95BA, &HA954E, _28.&HB4A43, &H4B5537, &HAD54A, &H955ABF, &H4BA53, &HA5B48, &H652BBC, &H52B50,&HA9345, &H474AB9, _29.&H6AA4C, &HAD541, &H24DAB6, &H4B64A, &H69573D, &HA4E51, &HD2646, &H5E933A,&HD534D, &H5AA43, _30.&H36B537, &H96D4B, &HB4AEBF, &H4AD53, &HA4D48, &H6D25BC, &HD254F, &HD5244,&H5DAA38, &HB5A4C, _31.&H56D41, &H24ADB6, &H49B4A, &H7A4BBE, &HA4B51, &HAA546, &H5B52BA, &H6D24E,&HADA42, &H355B37, _32.&H9374B, &H8497C1, &H49753, &H64B48, &H66A53C, &HEA54F, &H6B244, &H4AB638,&HAAE4C, &H92E42, _33.&H3C9735, &HC9649, &H7D4ABD, &HD4A51, &HDA545, &H55AABA, &H56A4E, &HA6D43,&H452EB7, &H52D4B, _34.&H8A95BF, &HA9553, &HB4A47, &H6B553B, &HAD54F, &H55A45, &H4A5D38, &HA5B4C,&H52B42, &H3A93B6, _35.&H69349, &H7729BD, &H6AA51, &HAD546, &H54DABA, &H4B64E, &HA5743, &H452738,&HD264A, &H8E933E, _36.&HD5252, &HDAA47, &H66B53B, &H56D4F, &H4AE45, &H4A4EB9, &HA4D4C, &HD1541,&H2D92B5, &HD5349)37.startyear = 190138.ng = LunarCal(q_year - startyear)39. d = &H10000040. LunarData.leapmonth = Int(ng / d)41. ng = ng Mod d42. d = &H8043. mdata = Int(ng / d)44. ng = ng Mod d45. d = &H2046. LunarData.sp_month = Int(ng / d)47. LunarData.sp_day = ng Mod d48. d = &H100049. i = 150. Do51. LunarData.month(i) = 29 + Int(mdata / d)52. mdata = mdata Mod d53. If d = 1 Then Exit Do54. d = d / 255. i = i + 156. Loop57. If LunarData.leapmonth = 0 Then LunarData.month(i) = 058.End Function59.Function lunar(Solar_date As Date, Optional Part As Integer = 0) As String60.'Part = 0, all; Part = 1, lunar year; Part = 2, lunar month; Part = 3, lunar day61.Dim a As ConvDataA62.l_year = Year(Solar_date)63.a = LunarData(l_year)64.sp_date = DateSerial(l_year, a.sp_month, a.sp_day)65.If sp_date > Solar_date Then66. l_year = l_year - 167. a = LunarData(l_year)68. sp_date = DateSerial(l_year, a.sp_month, a.sp_day)69.End If70.l_day = Solar_date - sp_date71.l_month = 172.IS_lunar_leapmonth = False73.y = a.month(l_month)74.Do While l_day >= y75. l_day = l_day - y76. If l_month = a.leapmonth Then IS_lunar_leapmonth = (Not IS_lunar_leapmonth)77. If IS_lunar_leapmonth Then78. y = a.month(13)79. Else80. l_month = l_month + 181. y = a.month(l_month)82. End If83.Loop84.l_day = l_day + 185.lunar = l_year & "-" & l_month & "-" & l_day86.If IS_lunar_leapmonth Then lunar = lunar & "-L"87.lunar = Choose(Part + 1, lunar, l_year, l_month, l_day)88.End Function89.Function solar(Lunar_date, Optional IS_lunar_leapmonth As Integer = 0) As String90.'IS_lunar_leapmonth = 0, No leap month; IS_lunar_leapmonth = 1, is leap month91.Dim a As ConvDataA92.Lunar_date = Split(Lunar_date, "-")93.s_year = Lunar_date(0)94.For Each C In Lunar_date95. If C = "L" Then IS_lunar_leapmonth = 196.Next97.a = LunarData(s_year)98.sp_date = DateSerial(s_year, a.sp_month, a.sp_day)99.If Lunar_date(1) <> a.leapmonth Then IS_lunar_leapmonth = 0100.x = Lunar_date(2)101.tm = Lunar_date(1) + IS_lunar_leapmonth - 1102.For i = 1 To tm103. x = x + a.month(i)104. If i = a.leapmonth And IS_lunar_leapmonth = 0 Then105. x = x + a.month(13)106. End If107.Next108.s_date = sp_date + x - 1109.solar = s_date110.End Function111.Function lunarbirth(Solar_birthday As Date, Optional Inquire_year As Integer) As String112. If Inquire_year = 0 Then113. Inquire_year = Left(lunar(Now), 4)114. lunarbirth = solar(Inquire_year & Mid(lunar(Solar_birthday), 5, 10)) 115. If CDate(lunarbirth) < Now - 1 Then Inquire_year = Inquire_year + 1 116. End If117. lunarbirth = solar(Inquire_year & Mid(lunar(Solar_birthday), 5, 10)) 118.End Function119.Function solarbirth(Solar_birthday As Date, Optional Inquire_year As Integer) As String120. If Inquire_year = 0 Then121. Inquire_year = Year(Now)122. solarbirth = DateSerial(Inquire_year, month(Solar_birthday), Day(Solar_birthday))123. If CDate(solarbirth) < Now - 1 Then Inquire_year = Inquire_year + 1 124. End If125. solarbirth = DateSerial(Inquire_year, month(Solar_birthday), Day(Solar_birthday))126.End Function。

单片机万年历程序代码

单片机万年历程序代码

单片机万年历程序代码以下是一个示例单片机万年历的程序代码:```c#include <reg51.h>typedef unsigned char uchar;typedef unsigned int uint;sbit K1 = P2^0; // 显示年份sbit K2 = P2^1; // 显示月份sbit K3 = P2^2; // 显示日期uchar code year_tab[] = {31,28,31,30,31,30,31,31,30,31,30,31}; uchar code week_tab[] = {0x06,0x07,0x01,0x02,0x03,0x04,0x05}; uchar year, month, day, week;void delay(uint ms){uint i, j;for(i=ms;i>0;i--)for(j=110;j>0;j--);}uchar getKey(){if(K1==0) {delay(5);if(K1==0)return 1;while(!K1);}if(K2==0) {delay(5);if(K2==0)return 2;while(!K2);}if(K3==0) {delay(5);if(K3==0)return 3;while(!K3);}return 0;}void display(uchar num) {P0 = num;delay(1);P0 = 0x00;}void init(){TMOD=0x01;TH0=0xFC;TL0=0x67;EA=1;ET0=1;TR0=1;}void main(){init();while(1) {uchar key = getKey();if(key == 1) {year++;if(year == 100)year = 0;}else if(key == 2) {month++;if(month == 13)month = 1;}else if(key == 3) {day++;if(day > year_tab[month-1]) { day = 1;}}display(year / 10);display(year % 10);display(month / 10);display(month % 10);display(day / 10);display(day % 10);display(week);}}void timer0() interrupt 1{TH0=0xFC;TL0=0x67;week++;if(week == 7)week = 0;}```该代码的主要思路是通过外部三个按键模拟年、月和日的调节,通过一个定时器不断更新星期的计数,然后将年、月、日和星期分别在数码管上显示出来。

VB获得相应日期农历的代码

VB获得相应日期农历的代码

VB获得相应日期农历的代码以下内容可以实现在VB的StatusBar控件中显示当前日期所对应的农历。

Dim WeekName(7), MonthAdd(11), NongliData(99), TianGan(9), DiZhi(11), ShuXiang(11), DayName(30), MonName(12)Dim curTime, curYear, curMonth, curDay, curWeekdayDim GongliStr, WeekdayStr, NongliStr, NongliDayStrDim i, m, n, k, isEnd, bit, TheDate'获取当前系统时间curTime = Now()'星期名WeekName(0) = " * "WeekName(1) = "星期日"WeekName(2) = "星期一"WeekName(3) = "星期二"WeekName(4) = "星期三"WeekName(5) = "星期四"WeekName(6) = "星期五"WeekName(7) = "星期六"'天干名称TianGan(0) = "甲"TianGan(1) = "乙"TianGan(2) = "丙"TianGan(3) = "丁"TianGan(5) = "己" TianGan(6) = "庚" TianGan(7) = "辛" TianGan(8) = "壬" TianGan(9) = "癸"'地支名称DiZhi(0) = "子" DiZhi(1) = "丑" DiZhi(2) = "寅" DiZhi(3) = "卯" DiZhi(4) = "辰" DiZhi(5) = "巳" DiZhi(6) = "午" DiZhi(7) = "未" DiZhi(8) = "申" DiZhi(9) = "酉" DiZhi(10) = "戌" DiZhi(11) = "亥"'属相名称ShuXiang(0) = "鼠" ShuXiang(1) = "牛" ShuXiang(2) = "虎" ShuXiang(3) = "兔" ShuXiang(4) = "龙" ShuXiang(5) = "蛇" ShuXiang(6) = "马" ShuXiang(7) = "羊"ShuXiang(9) = "鸡" ShuXiang(10) = "狗" ShuXiang(11) = "猪"'农历日期名DayName(0) = "*" DayName(1) = "初一" DayName(2) = "初二" DayName(3) = "初三" DayName(4) = "初四" DayName(5) = "初五" DayName(6) = "初六" DayName(7) = "初七" DayName(8) = "初八" DayName(9) = "初九" DayName(10) = "初十" DayName(11) = "十一" DayName(12) = "十二" DayName(13) = "十三" DayName(14) = "十四" DayName(15) = "十五" DayName(16) = "十六" DayName(17) = "十七" DayName(18) = "十八" DayName(19) = "十九" DayName(20) = "二十" DayName(21) = "廿一" DayName(22) = "廿二" DayName(23) = "廿三"DayName(24) = "廿四" DayName(25) = "廿五" DayName(26) = "廿六" DayName(27) = "廿七" DayName(28) = "廿八" DayName(29) = "廿九" DayName(30) = "三十"'农历月份名MonName(0) = "*" MonName(1) = "正" MonName(2) = "二" MonName(3) = "三" MonName(4) = "四" MonName(5) = "五" MonName(6) = "六" MonName(7) = "七" MonName(8) = "八" MonName(9) = "九" MonName(10) = "十" MonName(11) = "十一" MonName(12) = "腊"'公历每月前面的天数MonthAdd(0) = 0 MonthAdd(1) = 31 MonthAdd(2) = 59 MonthAdd(3) = 90 MonthAdd(4) = 120 MonthAdd(5) = 151MonthAdd(6) = 181 MonthAdd(7) = 212 MonthAdd(8) = 243 MonthAdd(9) = 273 MonthAdd(10) = 304 MonthAdd(11) = 334'农历数据NongliData(0) = 2635NongliData(1) = 333387 NongliData(2) = 1701 NongliData(3) = 1748 NongliData(4) = 267701 NongliData(5) = 694 NongliData(6) = 2391 NongliData(7) = 133423 NongliData(8) = 1175 NongliData(9) = 396438 NongliData(10) = 3402 NongliData(11) = 3749 NongliData(12) = 331177 NongliData(13) = 1453 NongliData(14) = 694 NongliData(15) = 201326 NongliData(16) = 2350 NongliData(17) = 465197 NongliData(18) = 3221 NongliData(19) = 3402 NongliData(20) = 400202NongliData(22) = 1386 NongliData(23) = 267611 NongliData(24) = 605 NongliData(25) = 2349 NongliData(26) = 137515 NongliData(27) = 2709 NongliData(28) = 464533 NongliData(29) = 1738 NongliData(30) = 2901 NongliData(31) = 330421 NongliData(32) = 1242 NongliData(33) = 2651 NongliData(34) = 199255 NongliData(35) = 1323 NongliData(36) = 529706 NongliData(37) = 3733 NongliData(38) = 1706 NongliData(39) = 398762 NongliData(40) = 2741 NongliData(41) = 1206 NongliData(42) = 267438 NongliData(43) = 2647 NongliData(44) = 1318 NongliData(45) = 204070 NongliData(46) = 3477 NongliData(47) = 461653 NongliData(48) = 1386 NongliData(49) = 2413 NongliData(50) = 330077NongliData(52) = 2637 NongliData(53) = 268877 NongliData(54) = 3365 NongliData(55) = 531109 NongliData(56) = 2900 NongliData(57) = 2922 NongliData(58) = 398042 NongliData(59) = 2395 NongliData(60) = 1179 NongliData(61) = 267415 NongliData(62) = 2635 NongliData(63) = 661067 NongliData(64) = 1701 NongliData(65) = 1748 NongliData(66) = 398772 NongliData(67) = 2742 NongliData(68) = 2391 NongliData(69) = 330031 NongliData(70) = 1175 NongliData(71) = 1611 NongliData(72) = 200010 NongliData(73) = 3749 NongliData(74) = 527717 NongliData(75) = 1452 NongliData(76) = 2742 NongliData(77) = 332397 NongliData(78) = 2350 NongliData(79) = 3222 NongliData(80) = 268949NongliData(82) = 3493NongliData(83) = 133973NongliData(84) = 1386NongliData(85) = 464219NongliData(86) = 605NongliData(87) = 2349NongliData(88) = 334123NongliData(89) = 2709NongliData(90) = 2890NongliData(91) = 267946NongliData(92) = 2773NongliData(93) = 592565NongliData(94) = 1210NongliData(95) = 2651NongliData(96) = 395863NongliData(97) = 1323NongliData(98) = 2707NongliData(99) = 265877'生成当前公历年、月、日 ==> GongliStr curYear = Year(curTime)curMonth = Month(curTime)curDay = Day(curTime)GongliStr = curYear & "年"If (curMonth < 10) ThenGongliStr = GongliStr & "0" & curMonth & "月" ElseGongliStr = GongliStr & curMonth & "月"End IfIf (curDay < 10) ThenGongliStr = GongliStr & "0" & curDay & "日"ElseGongliStr = GongliStr & curDay & "日"End If'生成当前公历星期 ==> WeekdayStrcurWeekday = Weekday(curTime)WeekdayStr = WeekName(curWeekday)'计算到初始时间1921年2月8日的天数:1921-2-8(正月初一) TheDate = (curYear - 1921) * 365 + Int((curYear - 1921) / 4) + curDay + MonthAdd(curMonth - 1) - 38If ((curYear Mod 4) = 0 And curMonth > 2) ThenTheDate = TheDate + 1End If'计算农历天干、地支、月、日isEnd = 0m = 0DoIf (NongliData(m) < 4095) Thenk = 11Elsek = 12End Ifn = kDoIf (n < 0) ThenExit DoEnd If'获取NongliData(m)的第n个二进制位的值bit = NongliData(m)For i = 1 To n Step 1bit = Int(bit / 2)Nextbit = bit Mod 2If (TheDate <= 29 + bit) ThenisEnd = 1Exit DoEnd IfTheDate = TheDate - 29 - bitn = n - 1LoopIf (isEnd = 1) ThenExit DoEnd Ifm = m + 1LoopcurYear = 1921 + mcurMonth = k - n + 1curDay = TheDateIf (k = 12) ThenIf (curMonth = (Int(NongliData(m) / 65536) + 1)) Then curMonth = 1 - curMonthElseIf (curMonth > (Int(NongliData(m) / 65536) + 1)) Then curMonth = curMonth - 1End IfEnd If'生成农历天干、地支、属相 ==> NongliStrNongliStr = "农历" & TianGan(((curYear - 4) Mod 60) Mod 10) & DiZhi(((curYear - 4) Mod 60) Mod 12) & "年"NongliStr = NongliStr & "(" & ShuXiang(((curYear - 4) Mod 60) Mod 12) & ")"'生成农历月、日 ==> NongliDayStrIf (curMonth < 1) ThenNongliDayStr = "闰" & MonName(-1 * curMonth)ElseNongliDayStr = MonName(curMonth)End IfNongliDayStr = NongliDayStr & "月"NongliDayStr = NongliDayStr & DayName(curDay)frmMain.StatusBar1.Panels(2).Text = "今天是:" & NongliStr & NongliDayStr。

单行带农历的日期时间代码

单行带农历的日期时间代码

单行带农历的日期时间代码单行带农历的日期时间代码<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>单行带农历的日期时间代码</title></head><body><SCRIPT language=JavaScript><!--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, 0, 1 ), new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 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, 1, 0 ),/* 93 */new tagLunarCal( 39, 0, 5, 20, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 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, 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, 1, 0, 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, 0, 1, 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, 1, 0, 1, 0, 1, 0 ), new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 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 ),/* 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, 1, 0 ) ];/* 民國年每月之日數 all by */SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];/* 民國年每月之累積日數, 平年與閏年 */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 ];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;elsed = 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;Age = kc % 60;if ( Age < 22 )Age = 22 - Age;elseAge = 82 - Age;if ( acc <= LunarCal[y].BaseDays ) {y--;LunarYear = SolarYear - 1;leap = GetLeap( LunarYear );sm += 12;acc = SolarDays[leap*14 + sm] + SolarDate; }elseLunarYear = 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();function initArray(){this.length=initArray.arguments.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");document.write("", today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日&nbsp;",d[today.getDay()+1],"");months = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];days = ["初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"];document.write( "&nbsp;农历"+months[LunarMonth-1]+"月" + days[LunarDate-1] + "");return 0;}/* 求此民國年是否為閏年, 返回 0 為平年, 1 為閏年 */function GetLeap( year ){if ( year % 400 == 0 )return 1;else if ( year % 100 == 0 )return 0;else if ( year % 4 == 0 )return 1;elsereturn 0;}function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) {this.BaseDays = d; /* 到民國 1 月 1 日到農曆正月初一的累積日數 */this.Intercalation = i; /* 閏月月份. 0==此年沒有閏月 */this.BaseWeekday = w; /* 此年民國 1 月 1 日為星期幾再減 1 */ this.BaseKanChih = k; /* 此年民國 1 月 1 日之干支序號減 1 */ this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此農曆年每月之大小, 0==小月(29日), 1==大月(30日) */}//--></SCRIPT><a target=_blank href=><FONT color=#2b68a7><SCRIPT>CalConv();</SCRIPT></FONT></a> </body></html>本代码由<a href=/myuserhome.aspx?isowner=1>【荷花小女子】</a>提供。

JS获取农历日期具体实例

JS获取农历日期具体实例

JS获取农历⽇期具体实例复制代码代码如下:<script type="text/javascript">var CalendarData = new Array(100);var madd = new Array(12);var tgString = "甲⼄丙丁戊⼰庚⾟壬癸";var dzString = "⼦丑寅卯⾠巳午未申⾣戌亥";var numString = "⼀⼆三四五六七⼋九⼗";var monString = "正⼆三四五六七⼋九⼗冬腊";var weekString = "⽇⼀⼆三四五六";var sx = "⿏⽜虎兔龙蛇马⽺猴鸡狗猪";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;}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; break;}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 = "";tmp += tgString.charAt((cYear - 4) % 10);tmp += dzString.charAt((cYear - 4) % 12);tmp += "(";tmp += sx.charAt((cYear - 4) % 12);tmp += ")年 ";if (cMonth < 1) {tmp += "(闰)";tmp += monString.charAt(-cMonth - 1);} else {tmp += monString.charAt(cMonth - 1);}tmp += "⽉";tmp += (cDay < 11) ? "初" : ((cDay < 20) ? "⼗" : ((cDay < 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();}}//调⽤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 = "19" + yy;function GetCNDate() {return GetLunarDay(yy, mm, dd);}$(document).ready(function () {var d = GetCNDate();alert(d);});</script>。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

农历时间日期<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>单行带农历的日期时间代码</title></head><body><SCRIPT language=JavaScript><!--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, 0, 1 ),new tagLunarCal( 46, 0, 4, 48, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1 ), /* 88 */ new tagLunarCal( 35, 0, 5, 53, 1, 1, 0, 0, 1, 0, 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, 1, 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, 0, 1, 0, 1, 0, 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, 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, 1, 0, 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, 0, 1, 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, 1, 0, 1, 0, 1, 0 ),new tagLunarCal( 21, 2, 6, 54, 0, 1, 0, 1, 0, 1, 0, 1, 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, 1, 0 ) ];/* 民國年每月之日數all by */SolarCal = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];/* 民國年每月之累積日數, 平年與閏年*/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 ];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;elsed = 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;Age = kc % 60;if ( Age < 22 )Age = 22 - Age;elseAge = 82 - Age;if ( acc <= LunarCal[y].BaseDays ) {y--;LunarYear = SolarYear - 1;leap = GetLeap( LunarYear );sm += 12;acc = SolarDays[leap*14 + sm] + SolarDate;}elseLunarYear = 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();function initArray(){this.length=initArray.arguments.lengthfor(var i=0;i<this.length;i++)this[i+1]=initArray.arguments[i] }var d=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六"); document.write("", today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日&nbsp;",d[today.getDay()+1],"");months = ["一","二","三","四","五","六","七","八","九","十","十一","十二"];days = ["初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十"];document.write( "&nbsp;农历"+months[LunarMonth-1]+"月" + days[LunarDate-1] + "");return 0;}/* 求此民國年是否為閏年, 返回0 為平年, 1 為閏年*/function GetLeap( year ){if ( year % 400 == 0 )return 1;else if ( year % 100 == 0 )return 0;else if ( year % 4 == 0 )return 1;elsereturn 0;}function tagLunarCal( d, i, w, k, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13) { this.BaseDays = d; /* 到民國1 月1 日到農曆正月初一的累積日數*/this.Intercalation = i; /* 閏月月份. 0==此年沒有閏月*/this.BaseWeekday = w; /* 此年民國1 月1 日為星期幾再減1 */this.BaseKanChih = k; /* 此年民國1 月1 日之干支序號減1 */this.MonthDays = [ m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13 ]; /* 此農曆年每月之大小, 0==小月(29日), 1==大月(30日) */}//--></SCRIPT><a target=_blank href=><FONT color=#2b68a7><SCRIPT>CalConv();</SCRIPT></FONT></a></body></html>本代码由<a href=>网页特效网</a>提供QQ菜单似的下拉门<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><title>下拉滚动门</title><style type="text/css">body{margin:10px;padding:10px;}body,td,div,span,li{font-size:12px;}.title01,.title02{color:#fff;font-weight:bold;}#DoorP{border:12px solid #eee; width:150px;height:300px;padding:4px; background:#fff;}.title01{width:100%;height:25px; background:#00ccff; cursor:pointer;}.title02{width:100%;height:25px; background:#99cc00; cursor:pointer;}.content{background:#eee;border-bottom:2px solid #fff; overflow:hidden;color:#666;padding-left:4px;padding-right:4px;line-height:18px;}</style><!--棕:#eee;蓝:#00ccff;绿:#99cc00;--></head><body><div id="DoorP"><table><tr><td>第一层信息</td></tr></table><div class="content">十三妖<br/>十三妖<br/>十三妖<br/></div><table><tr><td>第二层信息</td></tr></table><div class="content"> ThirdteenDevil</div><table><tr><td>第三层信息</td></tr></table><div class="content">devil13th</div></div><script type="text/javascript">var open = 2;// 设置初始打开的层序号var openState = new Array();var closeState = new Array();var dH = 220;function $(id){if(document.getElementById(id)) {return document.getElementById(id); }else{alert("没有找到!");}}function $tag(id,tagName){return $(id).getElementsByTagName(tagName)}function closeMe(Cid,Oid){var h = parseInt(Ds[Cid].style.height);//alert(h);if(h > 0){h = h - Math.ceil(h/3);Ds[Cid].style.height = h+"px";}else{openMe(Oid);clearTimeout(closeState[Cid]);return false;}closeState[Cid] = setTimeout("closeMe("+Cid+","+Oid+")"); }function openMe(Oid){var h = parseInt(Ds[Oid].style.height);//alert(h);if(h < dH){h = h + Math.ceil((dH-h)/3);Ds[Oid].style.height = h+"px";}else{clearTimeout(openState[Oid]);return false;}openState[Oid] = setTimeout("openMe("+Oid+")");}var Ds = $tag("DoorP","div");var Ts = $tag("DoorP","table");if(Ds.length != Ts.length){alert("标题和内容数目不相同!");}for(var i = 0 ; i < Ds.length ; i++){if(i==open){Ds[i].style.height = dH+"px";Ts[i].className="title01";}else{Ds[i].style.height = "0px";Ts[i].className="title02";}Ts[i].value = i;Ts[i].onclick = function(){if(open==this.value){return false;}Ts[open].className="title02";Ts[this.value].className="title01";for(var i = 0 ; i < openState.length ; i++){clearTimeout(openState[i]);clearTimeout(closeState[i]);}closeMe(open,this.value);//openMe(this.value);open = this.value;}}//直接打开层函数function showDiv(id){Ds[id].style.height=dH+"px";Ds[open].style.height="0px";open = id;}//渐渐打开层函数</script></body></html>本代码由<a href=>网页特效网</a>提供文字的折叠与展开<div align="center"><table border="0" width="300" cellpadding="0" style="border-collapse: collapse" id="table1" bgcolor="#F3F3F3" cellspacing="10"><tr><td valign="top" style="line-height: 150%"><div class="block" id="smallContent" style="display:block"><span style="font-size: 9pt"> <b>专辑介绍:</b>青春光影是由中国80后影像精英共同组建的新媒体影视摄制机构。

相关文档
最新文档