求DELPHI农历源码
解决方案 »
- SQLServer2005安装了SP2和SP3之后,查询一下子变得特别慢
- 怎样设置.~pas,.~dfm保存到另外的目录?
- 简单问题:怎样让下一个空件得到焦点,不是用.SetFocus。就是回车后下一个空件自动得到焦点
- 在stringgrid中能否设置单元格或者单元列中字体的颜色?
- installshield professional6.22安装时的password??????????
- cxdbtreelist如何改变被选中节点的那行的颜色
- dbimage怎么存放jpg格式图片?
- 那位高手用过『流光IV』?
- SPCOMM中procedure ReceiveData(Sender: TObject; Buffer: Pointer;BufferLength: Word);
- 需ICON文件格式,那为仁兄手头有?可否mail一份来?[email protected]
- 求助!
- 如何同步两个文件夹(是比对后两个文件夹的内容完全一样)!
现在首页都可以看见
http://lysoft.7u7.net
///数据格式说明:///如1901年的节气为////1月 2月 3月 4月 5月 6月 7月 8月 9月 10月 11月12月///6, 21, 4, 19, 6, 21, 5, 21, 6,22, 6,22, 8, 23, 8, 24, 8, 24, 8, 24, 8,23, 8, 22///9, 6, 11,4, 9, 6, 10,6, 9,7, 9,7, 7, 8, 7, 9, 7, 9, 7, 9, 7,8, 7, 15///上面第一行数据为每月节气对应日期,15减去每月第一个节气,每月第二个节气减去15得第二行///这样每月两个节气对应数据都小于16,每月用一个字节存放,高位存放第一个节气数据,低位存放///第二个节气的数据,可得下表gLunarHolDay:array[0..1799] of Byte=($96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1901$96, $A4, $96, $96, $97, $87, $79, $79, $79, $69, $78, $78, ///1902$96, $A5, $87, $96, $87, $87, $79, $69, $69, $69, $78, $78, ///1903$86, $A5, $96, $A5, $96, $97, $88, $78, $78, $79, $78, $87, ///1904$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1905$96, $A4, $96, $96, $97, $97, $79, $79, $79, $69, $78, $78, ///1906$96, $A5, $87, $96, $87, $87, $79, $69, $69, $69, $78, $78, ///1907$86, $A5, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1908$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1909$96, $A4, $96, $96, $97, $97, $79, $79, $79, $69, $78, $78, ///1910$96, $A5, $87, $96, $87, $87, $79, $69, $69, $69, $78, $78, ///1911$86, $A5, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1912$95, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1913$96, $B4, $96, $A6, $97, $97, $79, $79, $79, $69, $78, $78, ///1914$96, $A5, $97, $96, $97, $87, $79, $79, $69, $69, $78, $78, ///1915$96, $A5, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1916$95, $B4, $96, $A6, $96, $97, $78, $79, $78, $69, $78, $87, ///1917$96, $B4, $96, $A6, $97, $97, $79, $79, $79, $69, $78, $77, ///1918$96, $A5, $97, $96, $97, $87, $79, $79, $69, $69, $78, $78, ///1919$96, $A5, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1920$95, $B4, $96, $A5, $96, $97, $78, $79, $78, $69, $78, $87, ///1921$96, $B4, $96, $A6, $97, $97, $79, $79, $79, $69, $78, $77, ///1922$96, $A4, $96, $96, $97, $87, $79, $79, $69, $69, $78, $78, ///1923$96, $A5, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1924$95, $B4, $96, $A5, $96, $97, $78, $79, $78, $69, $78, $87, ///1925$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1926$96, $A4, $96, $96, $97, $87, $79, $79, $79, $69, $78, $78, ///1927$96, $A5, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1928$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1929$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1930$96, $A4, $96, $96, $97, $87, $79, $79, $79, $69, $78, $78, ///1931$96, $A5, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1932$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1933$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1934$96, $A4, $96, $96, $97, $97, $79, $79, $79, $69, $78, $78, ///1935$96, $A5, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1936$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1937$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1938$96, $A4, $96, $96, $97, $97, $79, $79, $79, $69, $78, $78, ///1939$96, $A5, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1940$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1941$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1942$96, $A4, $96, $96, $97, $97, $79, $79, $79, $69, $78, $78, ///1943$96, $A5, $96, $A5, $A6, $96, $88, $78, $78, $78, $87, $87, ///1944$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1945$95, $B4, $96, $A6, $97, $97, $78, $79, $78, $69, $78, $77, ///1946$96, $B4, $96, $A6, $97, $97, $79, $79, $79, $69, $78, $78, ///1947$96, $A5, $A6, $A5, $A6, $96, $88, $88, $78, $78, $87, $87, ///1948$A5, $B4, $96, $A5, $96, $97, $88, $79, $78, $79, $77, $87, ///1949$95, $B4, $96, $A5, $96, $97, $78, $79, $78, $69, $78, $77, ///1950$96, $B4, $96, $A6, $97, $97, $79, $79, $79, $69, $78, $78, ///1951$96, $A5, $A6, $A5, $A6, $96, $88, $88, $78, $78, $87, $87, ///1952$A5, $B4, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1953$95, $B4, $96, $A5, $96, $97, $78, $79, $78, $68, $78, $87, ///1954$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1955$96, $A5, $A5, $A5, $A6, $96, $88, $88, $78, $78, $87, $87, ///1956$A5, $B4, $96, $A5, $96, $97, $88, $78, $78, $79, $77, $87, ///1957$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1958$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1959$96, $A4, $A5, $A5, $A6, $96, $88, $88, $88, $78, $87, $87, ///1960$A5, $B4, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1961$96, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1962$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1963$96, $A4, $A5, $A5, $A6, $96, $88, $88, $88, $78, $87, $87, ///1964$A5, $B4, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1965$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1966$96, $B4, $96, $A6, $97, $97, $78, $79, $79, $69, $78, $77, ///1967$96, $A4, $A5, $A5, $A6, $A6, $88, $88, $88, $78, $87, $87, ///1968$A5, $B4, $96, $A5, $96, $96, $88, $78, $78, $78, $87, $87, ///1969$95, $B4, $96, $A5, $96, $97, $88, $78, $78, $69, $78, $87, ///1970
function WeekDay(iYear,iMonth,iDay:Word):Integer;beginResult:=DayOfWeek(EncodeDate(iYear,iMonth,iDay));end;function WeekNum(const TDT:TDateTime):Word;varY,M,D:Word;dtTmp:TDateTime;beginDecodeDate(TDT,Y,M,D);dtTmp:=EnCodeDate(Y,1,1);Result:=(Trunc(TDT-dtTmp)+(DayOfWeek(dtTmp)-1)) div 7;if Result=0 thenResult:=51elseResult:=Result-1;end;function WeekNum(const iYear,iMonth,iDay:Word):Word;beginResult:=WeekNum(EncodeDate(iYear,iMonth,iDay));end;function MonthDays(iYear,iMonth:Word):Word;begincase iMonth of1,3,5,7,8,10,12: Result:=31;4,6,9,11: Result:=30;2://如果是闰年if IsLeapYear(iYear) thenResult:=29elseResult:=28elseResult:=0;end;end;function GetLeapMonth(iLunarYear:Word):Word;varFlag:Byte;beginFlag:=gLunarMonth[(iLunarYear-START_YEAR) div 2];if (iLunarYear-START_YEAR) mod 2=0 thenResult:=Flag shr 4elseResult:=Flag and $0F;end;function LunarMonthDays(iLunarYear,iLunarMonth:Word):Longword;varHeight,Low:Word;iBit:Integer;beginif iLunarYear<START_YEAR thenbeginResult:=30;Exit;end;Height:=0;Low:=29;iBit:=16-iLunarMonth;if (iLunarMonth>GetLeapMonth(iLunarYear)) and (GetLeapMonth(iLunarYear)>0)thenDec(iBit);if (gLunarMonthDay[iLunarYear-START_YEAR] and (1 shl iBit))>0 thenInc(Low);if iLunarMonth=GetLeapMonth(iLunarYear) thenif (gLunarMonthDay[iLunarYear-START_YEAR] and (1 shl (iBit-1)))>0 thenHeight:=30elseHeight:=29;Result:=MakeLong(Low,Height);end;function LunarYearDays(iLunarYear:Word):Word;varDays,i:Word;tmp:Longword;beginDays:=0;for i:=1 to 12 dobegintmp:=LunarMonthDays(iLunarYear,i);Days:=Days+HiWord(tmp);Days:=Days+LoWord(tmp);end;Result:=Days;end;procedure FormatLunarYear(iYear:Word;var pBuffer:string);varszText1,szText2,szText3:string;beginszText1:='甲乙丙丁戊己庚辛壬癸';szText2:='子丑寅卯辰巳午未申酉戌亥';szText3:='鼠牛虎免龙蛇马羊猴鸡狗猪';pBuffer:=Copy(szText1,((iYear-4) mod 10)*2+1,2);pBuffer:=pBuffer+Copy(szText2,((iYear-4) mod 12)*2+1,2);pBuffer:=pBuffer+' ';pBuffer:=pBuffer+Copy(szText3,((iYear-4) mod 12)*2+1,2);pBuffer:=pBuffer+'年';end;function FormatLunarYear(iYear:Word):string;varpBuffer:string;beginFormatLunarYear(iYear,pBuffer);Result:=pBuffer;end;procedure FormatMonth(iMonth:Word;var pBuffer:string;bLunar:Boolean);varszText:string;beginif (not bLunar) and (iMonth=1) thenbeginpBuffer:=' 一月';Exit;end;szText:='正二三四五六七八九十';if iMonth<=10 thenbeginpBuffer:=' ';pBuffer:=pBuffer+Copy(szText,(iMonth-1)*2+1,2);pBuffer:=pBuffer+'月';Exit;end;if iMonth=11 thenpBuffer:='十一'elsepBuffer:='十二';pBuffer:=pBuffer+'月';end;function FormatMonth(iMonth:Word;bLunar:Boolean):string;varpBuffer:string;beginFormatMonth(iMonth,pBuffer,bLunar);Result:=pBuffer;end;procedure FormatLunarDay(iDay:Word;var pBuffer:string);varszText1,szText2:string;beginszText1:='初十廿三';szText2:='一二三四五六七八九十';if (iDay<>20) and (iDay<>30) thenbeginpBuffer:=Copy(szText1,((iDay-1) div 10)*2+1,2);pBuffer:=pBuffer+Copy(szText2,((iDay-1) mod 10)*2+1,2);endelsebeginpBuffer:=Copy(szText1,(iDay div 10)*2+1,2);pBuffer:=pBuffer+'十';end;end;function FormatLunarDay(iDay:Word):string;varpBuffer:string;beginFormatLunarDay(iDay,pBuffer);Result:=pBuffer;end;functionCalcDateDiff(iEndYear,iEndMonth,iEndDay:Word;iStartYear:Word;iStartMonth:Word;iStartDay:Word):Longword;beginResult:=Trunc(EncodeDate(iEndYear,iEndMonth,iEndDay)-EncodeDate(iStartYear,iStartMonth,iStartDay));end;function CalcDateDiff(EndDate,StartDate:TDateTime):Longword;beginResult:=Trunc(EndDate-StartDate);end;function GetLunarDate(iYear,iMonth,iDay:Word;variLunarYear,iLunarMonth,iLunarDay:Word):Word;beginl_CalcLunarDate(iLunarYear,iLunarMonth,iLunarDay,CalcDateDiff(iYear,iMonth,iDay));Result:=l_GetLunarHolDay(iYear,iMonth,iDay);end;procedure GetLunarDate(InDate:TDateTime;variLunarYear,iLunarMonth,iLunarDay:Word);beginl_CalcLunarDate(iLunarYear,iLunarMonth,iLunarDay,CalcDateDiff(InDate,EncodeDate(START_YEAR,1,1)));end;procedure l_CalcLunarDate(var iYear,iMonth,iDay:Word;iSpanDays:Longword);vartmp:Longword;begin///阳历1901年2月19日为阴历1901年正月初一///阳历1901年1月1日到2月19日共有49天if iSpanDays<49 thenbeginiYear:=START_YEAR-1;if iSpanDays<19 thenbeginiMonth:=11;iDay:=11+Word(iSpanDays);endelsebeginiMonth:=12;iDay:=Word(iSpanDays)-18;end;Exit;end;///下面从阴历1901年正月初一算起iSpanDays:=iSpanDays-49;iYear:=START_YEAR;iMonth:=1;iDay:=1;///计算年tmp:=LunarYearDays(iYear);while iSpanDays>=tmp dobeginiSpanDays:=iSpanDays-tmp;Inc(iYear);tmp:=LunarYearDays(iYear);end;///计算月tmp:=LoWord(LunarMonthDays(iYear,iMonth));while iSpanDays>=tmp dobeginiSpanDays:=iSpanDays-tmp;if iMonth=GetLeapMonth(iYear) thenbegintmp:=HiWord(LunarMonthDays(iYear,iMonth));if iSpanDays<tmp thenBreak;iSpanDays:=iSpanDays-tmp;end;Inc(iMonth);tmp:=LoWord(LunarMonthDays(iYear,iMonth));end;///计算日iDay:=iDay+Word(iSpanDays);end;function l_GetLunarHolDay(iYear,iMonth,iDay:Word):Word;varFlag:Byte;Day:Word;beginFlag:=gLunarHolDay[(iYear-START_YEAR)*12+iMonth-1];if iDay<15 thenDay:=15-((Flag shr 4) and $0f)elseDay:=(Flag and $0f)+15;if iDay=Day thenif iDay>15 thenResult:=(iMonth-1)*2+2elseResult:=(iMonth-1)*2+1elseResult:=0;end;function GetLunarHolDay(InDate:TDateTime):string;vari,iYear,iMonth,iDay:Word;beginDecodeDate(InDate,iYear,iMonth,iDay);i:=l_GetLunarHolDay(iYear,iMonth,iDay);case i of1:Result:='小寒';2:Result:='大寒';3:Result:='立春';4:Result:='雨水';5:Result:='惊蛰';6:Result:='春分';7:Result:='清明';8:Result:='谷雨';9:Result:='立夏';10:Result:='小满';11:Result:='芒种';12:Result:='夏至';13:Result:='小暑';14:Result:='大暑';15:Result:='立秋';16:Result:='处暑';17:Result:='白露';18:Result:='秋分';19:Result:='寒露';20:Result:='霜降';21:Result:='立冬';22:Result:='小雪';23:Result:='大雪';24:Result:='冬至';elseResult:='';end;end;function GetLunarHolDay(iYear,iMonth,iDay:Word):string;beginResult:=GetLunarHolDay(EncodeDate(iYear,iMonth,iDay));end;end.