const
START_YEAR=1901;
END_YEAR=2050;
//iYear 연도 1년의 iMonth 월의 일수를 반환합니다. 1월---12월 65535
functionMonthDays(iYear,iMonth:Word):Word;
//음력 iLunarYer 연도와 음력 iLunarMonth의 일수를 반환합니다. iLunarMonth가 윤월인 경우
//높은 문자는 두 번째 iLunarMonth 월의 일수이고, 그렇지 않은 경우 높은 문자는 1월 01901---2050년 12월입니다.
functionLunarMonthDays(iLunarYear,iLunarMonth:Word):Longword;
//1901년 1월부터 2050년 12월까지 음력 iLunarYear의 총 일수를 반환합니다.
functionLunarYearDays(iLunarYear:Word):Word;
//음력 iLunarYear의 윤월을 반환합니다. 그렇지 않으면 01901 2050년 1월---12월을 반환합니다.
functionGetLeapMonth(iLunarYear:Word):Word;
//iYear를 Tianqian 표기법으로 표현되는 문자열로 형식화합니다.
PRocedureFormatLunarYear(iYear:Word;varpBuffer:string);오버로드;
functionFormatLunarYear(iYear:Word):string;overload;
//iMonth를 중국어 문자열로 포맷합니다.
ProcedureFormatMonth(iMonth:Word;varpBuffer:string;bLunar:Boolean=True);overload;
functionFormatMonth(iMonth:Word;bLunar:Boolean=True):string;overload;
//iDay를 중국어 문자열로 형식화합니다.
ProcedureFormatLunarDay(iDay:Word;varpBuffer:string);오버로드;
functionFormatLunarDay(iDay:Word):string;overload;
//그레고리력의 두 날짜 사이의 일수를 계산합니다. 1년 1월 1일---65535년 12월 31일
functionCalcDateDiff(iEndYear,iEndMonth,iEndDay:Word;iStartYear:Word=START_YEAR;iStartMonth:Word=1;iStartDay:Word=1):Longword;overload;
functionCalcDateDiff(EndDate,StartDate:TDateTime):Longword;overload;
//양력 iYear에서 iMonth 월 iDay에 해당하는 음력 날짜를 계산하고 해당 음력 절기 0-24를 반환합니다.
//1901년 1월 1일---2050년 12월 31일
functionGetLunarHolDay(InDate:TDateTime):string;overload;
functionGetLunarHolDay(iYear,iMonth,iDay:Word):string;overload;
//개인 함수---------------
//1901년 1월 1일부터 iSpanDays일 이후의 음력 날짜를 계산합니다.
Procedurel_CalcLunarDate(variYear,iMonth,iDay:Word;iSpanDays:Longword);
//그레고리력의 iMonth, iDay, iYear에 해당하는 절기 0~24를 계산합니다. 0은 절기가 아님을 의미합니다.
functionl_GetLunarHolDay(iYear,iMonth,iDay:Word):Word;
구현
var
//gLunarDay 배열은 음력 1901년부터 2100년까지 매년의 월과 일 수를 저장합니다.
//음력은 한 달에 29일 또는 30일만 있을 수 있으며, 1년은 12(또는 13)개의 이진수로 표시됩니다. 해당 숫자는 1로 30일을 의미하고 그렇지 않으면 29일입니다.
gLunarMonthDay:배열[0..149]ofWord=(
//테스트 데이터는 1901.1.1--2050.12.31 입니다.
$4ae0,$a570,$5268,$d260,$d950,$6aa8,$56a0,$9ad0,$4ae8,$4ae0,//1910
$a4d8,$a4d0,$d250,$d548,$b550,$56a0,$96d0,$95b0,$49b8,$49b0,//1920
$a4b0,$b258,$6a50,$6d40,$ada8,$2b60,$9570,$4978,$4970,$64b0,//1930
$d4a0,$ea50,$6d48,$5ad0,$2b60,$9370,$92e0,$c968,$c950,$d4a0,//1940
$da50,$b550,$56a0,$aad8,$25d0,$92d0,$c958,$a950,$b4a8,$6ca0,//1950
$b550,$55a8,$4da0,$a5b0,$52b8,$52b0,$a950,$e950,$6aa0,$ad50,//1960
$ab50,$4b60,$a570,$a570,$5260,$e930,$d950,$5aa8,$56a0,$96d0,//1970
$4ae8,$4ad0,$a4d0,$d268,$d250,$d528,$b540,$b6a0,$96d0,$95b0,//1980
$49b0,$a4b8,$a4b0,$b258,$6a50,$6d40,$ada0,$ab60,$9370,$4978,//1990
$4970,$64b0,$6a50,$ea50,$6b28,$5ac0,$ab60,$9368,$92e0,$c960,//2000
$d4a8,$d4a0,$da50,$5aa8,$56a0,$aad8,$25d0,$92d0,$c958,$a950,//2010
$b4a0,$b550,$b550,$55a8,$4ba0,$a5b0,$52b8,$52b0,$a930,$74a8,//2020
$6aa0,$ad50,$4da8,$4b60,$9570,$a4e0,$d260,$e930,$d530,$5aa0,//2030
$6b50,$96d0,$4ae8,$4ad0,$a4d0,$d258,$d250,$d520,$daa0,$b5a0,//2040
$56d0,$4ad8,$49b0,$a4b8,$a4b0,$aa50,$b528,$6d20,$ada0,$55b0);//2050
//gLanarMonth 배열은 음력 1901년부터 2050년까지의 윤월을 저장합니다. 윤월이 없으면 0입니다. 각 바이트는 2년 동안 저장됩니다.
gLunarMonth:배열[0..74]ofByte=(
$00,$50,$04,$00,$20,//1910
$60,$05,$00,$20,$70,//1920
$05,$00,$40,$02,$06,//1930
$00,$50,$03,$07,$00,//1940
$60,$04,$00,$20,$70,//1950
$05,$00,$30,$80,$06,//1960
$00,$40,$03,$07,$00,//1970
$50,$04,$08,$00,$60,//1980
$04,$0a,$00,$60,$05,//1990
$00,$30,$80,$05,$00,//2000
$40,$02,$07,$00,$50,//2010
$04,$09,$00,$60,$04,//2020
$00,$20,$60,$05,$00,//2030
$30,$b0,$06,$00,$50,//2040
$02,$07,$00,$50,$03);//2050
//gLanarHoliDay 배열은 매년 24절기에 해당하는 양력 날짜를 저장합니다.
//매년 24절기에 해당하는 태양력 날짜는 거의 고정되어 있으며 12개월에 균등하게 분포됩니다.
//1월 2월 3월 4월 5월 6월
//소한, 대추, 입춘, 비, 춘분, 청명, 곡우, 초여름, 소만주, 하지
//7월, 8월, 9월, 10월, 11월, 12월
//약한 여름, 큰 더위, 시작되는 가을, 여름, 흰 이슬, 추분, 차가운 이슬, 서리, 시작되는 겨울, 가벼운 눈, 큰 눈, 동지
**************************************************** ***** *********************************
절기에는 정해진 규칙이 없어서 공간을 절약하기 위해 테이블을 저장해야 하므로...
************************************************** * *********************************}
//데이터 형식 설명:
//예를 들어 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:배열[0..1799]ofByte=(
$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
$96,$B4,$96,$A6,$97,$97,$78,$79,$79,$69,$78,$77,//1971
$96,$A4,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//1972
$A5,$B5,$96,$A5,$A6,$96,$88,$78,$78,$78,$87,$87,//1973
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$69,$78,$87,//1974
$96,$B4,$96,$A6,$97,$97,$78,$79,$78,$69,$78,$77,//1975
$96,$A4,$A5,$B5,$A6,$A6,$88,$89,$88,$78,$87,$87,//1976
$A5,$B4,$96,$A5,$96,$96,$88,$88,$78,$78,$87,$87,//1977
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$79,$78,$87,//1978
$96,$B4,$96,$A6,$96,$97,$78,$79,$78,$69,$78,$77,//1979
$96,$A4,$A5,$B5,$A6,$A6,$88,$88,$88,$78,$87,$87,//1980
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$77,$87,//1981
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$79,$77,$87,//1982
$95,$B4,$96,$A5,$96,$97,$78,$79,$78,$69,$78,$77,//1983
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$87,//1984
$A5,$B4,$A6,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//1985
$A5,$B4,$96,$A5,$96,$97,$88,$78,$78,$79,$77,$87,//1986
$95,$B4,$96,$A5,$96,$97,$88,$79,$78,$69,$78,$87,//1987
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//1988
$A5,$B4,$A5,$A5,$A6,$96,$88,$88,$88,$78,$87,$87,//1989
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$79,$77,$87,//1990
$95,$B4,$96,$A5,$86,$97,$88,$78,$78,$69,$78,$87,//1991
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//1992
$A5,$B3,$A5,$A5,$A6,$96,$88,$88,$88,$78,$87,$87,//1993
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$78,$87,$87,//1994
$95,$B4,$96,$A5,$96,$97,$88,$76,$78,$69,$78,$87,//1995
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//1996
$A5,$B3,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//1997
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$78,$87,$87,//1998
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$69,$78,$87,//1999
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//2000
$A5,$B3,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2001
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$78,$87,$87,//2002
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$69,$78,$87,//2003
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//2004
$A5,$B3,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2005
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2006
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$69,$78,$87,//2007
$96,$B4,$A5,$B5,$A6,$A6,$87,$88,$87,$78,$87,$86,//2008
$A5,$B3,$A5,$B5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2009
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2010
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$79,$78,$87,//2011
$96,$B4,$A5,$B5,$A5,$A6,$87,$88,$87,$78,$87,$86,//2012
$A5,$B3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$87,//2013
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2014
$95,$B4,$96,$A5,$96,$97,$88,$78,$78,$79,$77,$87,//2015
$95,$B4,$A5,$B4,$A5,$A6,$87,$88,$87,$78,$87,$86,//2016
$A5,$C3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$87,//2017
$A5,$B4,$A6,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2018
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$79,$77,$87,//2019
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$78,$87,$86,//2020
$A5,$C3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//2021
$A5,$B4,$A5,$A5,$A6,$96,$88,$88,$88,$78,$87,$87,//2022
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$79,$77,$87,//2023
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$78,$87,$96,//2024
$A5,$C3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//2025
$A5,$B3,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2026
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$78,$87,$87,//2027
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$78,$87,$96,//2028
$A5,$C3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//2029
$A5,$B3,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2030
$A5,$B4,$96,$A5,$96,$96,$88,$78,$78,$78,$87,$87,//2031
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$78,$87,$96,//2032
$A5,$C3,$A5,$B5,$A6,$A6,$88,$88,$88,$78,$87,$86,//2033
$A5,$B3,$A5,$A5,$A6,$A6,$88,$78,$88,$78,$87,$87,//2034
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2035
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$78,$87,$96,//2036
$A5,$C3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$86,//2037
$A5,$B3,$A5,$A5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2038
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2039
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$78,$87,$96,//2040
$A5,$C3,$A5,$B5,$A5,$A6,$87,$88,$87,$78,$87,$86,//2041
$A5,$B3,$A5,$B5,$A6,$A6,$88,$88,$88,$78,$87,$87,//2042
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2043
$95,$B4,$A5,$B4,$A5,$A6,$97,$87,$87,$88,$87,$96,//2044
$A5,$C3,$A5,$B4,$A5,$A6,$87,$88,$87,$78,$87,$86,//2045
$A5,$B3,$A5,$B5,$A6,$A6,$87,$88,$88,$78,$87,$87,//2046
$A5,$B4,$96,$A5,$A6,$96,$88,$88,$78,$78,$87,$87,//2047
$95,$B4,$A5,$B4,$A5,$A5,$97,$87,$87,$88,$86,$96,//2048
$A4,$C3,$A5,$A5,$A5,$A6,$97,$87,$87,$78,$87,$86,//2049
$A5,$C3,$A5,$B5,$A6,$A6,$87,$88,$78,$78,$87,$87);//2050
functionMonthDays(iYear,iMonth:Word):Word;
시작하다
케이스아이월
1,3,5,7,8,10,12:결과:=31;
4,6,9,11:결과:=30;
2://윤년인 경우
ifIsLeapYear(iYear)다음
결과:=29
또 다른
결과:=28
또 다른
결과:=0;
끝;
끝;
functionGetLeapMonth(iLunarYear:Word):Word;
var
플래그:바이트;
시작하다
플래그:=gLunarMonth[(iLunarYear-START_YEAR)div2];
if(iLunarYear-START_YEAR)mod2=0then
결과:=Flagshr4
또 다른
결과:=플래그앤드$0F;
끝;
functionLunarMonthDays(iLunarYear,iLunarMonth:Word):Longword;
var
키,낮음:단어;
아이비트:정수;
시작하다
ifiLunarYear<START_YEARthen
시작하다
결과:=30;
출구;
끝;
높이:=0;
낮음:=29;
iBit:=16-iLunarMonth;
if(iLunarMonth>GetLeapMonth(iLunarYear))and(GetLeapMonth(iLunarYear)>0)then
12월(아이비트);
if(gLunarMonthDay[iLunarYear-START_YEAR]and(1shliBit))>0then
Inc(낮음);
ifiLunarMonth=GetLeapMonth(iLunarYear)그런 다음
if(gLunarMonthDay[iLunarYear-START_YEAR]and(1shl(iBit-1)))>0then
높이:=30
또 다른
높이:=29;
결과:=MakeLong(낮음,높이);
끝;
functionLunarYearDays(iLunarYear:Word):Word;
var
일, i:단어;
tmp:긴 단어;
시작하다
일수:=0;
fori:=1to12do
시작하다
tmp:=LunarMonthDays(iLunarYear,i);
일:=일+HiWord(tmp);
일:=일+LoWord(tmp);
끝;
결과:=일;
끝;
ProcedureFormatLunarYear(iYear:Word;varpBuffer:string);
var
szText1,szText2,szText3:문자열;
시작하다
szText1:='A, B, C, D, 우, 지, Geng, 신, Rengui';
szText2:='Zichou Yinmaochen Siwu는 Youxuhai에 지원하지 않았습니다.';
szText3:='쥐, 소, 호랑이, 용, 뱀, 말, 양, 원숭이, 닭, 개, 돼지';
pBuffer:=Copy(szText1,((iYear-4)mod10)*2+1,2);
pBuffer:=pBuffer+Copy(szText2,((iYear-4)mod12)*2+1,2);
pBuffer:=pBuffer+'';
pBuffer:=pBuffer+Copy(szText3,((iYear-4)mod12)*2+1,2);
pBuffer:=pBuffer+'연도';
끝;
functionFormatLunarYear(iYear:Word):string;
var
pBuffer:문자열;
시작하다
FormatLunarYear(iYear,pBuffer);
결과:=pBuffer;
끝;
ProcedureFormatMonth(iMonth:Word;varpBuffer:string;bLunar:Boolean);
var
szText:문자열;
시작하다
if(notbLunar)and(iMonth=1)then
시작하다
pBuffer:='1월';
출구;
끝;
szText:='양수 2, 3, 4, 5, 6, 7, 8, 90';
ifiMonth<=10then
시작하다
pBuffer:='';
pBuffer:=pBuffer+Copy(szText,(iMonth-1)*2+1,2);
pBuffer:=pBuffer+'월';
출구;
끝;
ifiMonth=11그러면
pBuffer:='11'
또 다른
pBuffer:='12';
pBuffer:=pBuffer+'월';
끝;
functionFormatMonth(iMonth:Word;bLunar:Boolean):string;
var
pBuffer:문자열;
시작하다
FormatMonth(iMonth,pBuffer,bLunar);
결과:=pBuffer;
끝;
ProcedureFormatLunarDay(iDay:Word;varpBuffer:string);
var
szText1,szText2:문자열;
시작하다
szText1:='음력 23일';
szText2:='일 둘 셋 넷 다섯 여섯 일곱 여덟 구십';
if(iDay<>20)및(iDay<>30)then
시작하다
pBuffer:=Copy(szText1,((iDay-1)div10)*2+1,2);
pBuffer:=pBuffer+Copy(szText2,((iDay-1)mod10)*2+1,2);
끝
또 다른
시작하다
pBuffer:=Copy(szText1,(iDaydiv10)*2+1,2);
pBuffer:=pBuffer+'十';
끝;
끝;
functionFormatLunarDay(iDay:Word):string;
var
pBuffer:문자열;
시작하다
FormatLunarDay(iDay,pBuffer);
결과:=pBuffer;
끝;
functionCalcDateDiff(iEndYear,iEndMonth,iEndDay:Word;iStartYear:Word;iStartMonth:Word;iStartDay:Word):Longword;
시작하다
결과:=Trunc(EncodeDate(iEndYear,iEndMonth,iEndDay)-EncodeDate(iStartYear,iStartMonth,iStartDay));
끝;
functionCalcDateDiff(EndDate,StartDate:TDateTime):Longword;
시작하다
결과:=Trunc(EndDate-StartDate);
끝;
Procedurel_CalcLunarDate(variYear,iMonth,iDay:Word;iSpanDays:Longword);
var
tmp:긴 단어;
시작하다
//양력 1901년 2월 19일은 음력 1901년 1월 1일이다.
//1901년 1월 1일부터 2월 19일까지 그레고리력의 49일입니다.
ifiSpanDays<49then
시작하다
iYear:=START_YEAR-1;
ifiSpanDays<19then
시작하다
i월:=11;
iDay:=11+Word(iSpanDays);
끝
또 다른
시작하다
i월:=12;
iDay:=Word(iSpanDays)-18;
끝;
출구;
끝;
//다음 계산은 1901년 음력 1월 1일부터 시작됩니다.
iSpanDays:=iSpanDays-49;
iYear:=START_YEAR;
i월:=1;
아이데이:=1;
//연도 계산
tmp:=LunarYearDays(iYear);
whileiSpanDays>=tmpdo
시작하다
iSpanDays:=iSpanDays-tmp;
Inc(iYear);
tmp:=LunarYearDays(iYear);
끝;
//월 계산
tmp:=LoWord(LunarMonthDays(iYear,iMonth));
whileiSpanDays>=tmpdo
시작하다
iSpanDays:=iSpanDays-tmp;
ifiMonth=GetLeapMonth(iYear)그러면
시작하다
tmp:=HiWord(LunarMonthDays(iYear,iMonth));
ifiSpanDays<tmpthenBreak;
iSpanDays:=iSpanDays-tmp;
끝;
Inc(i월);
tmp:=LoWord(LunarMonthDays(iYear,iMonth));
끝;
//일 계산
iDay:=iDay+Word(iSpanDays);
끝;
functionl_GetLunarHolDay(iYear,iMonth,iDay:Word):Word;
var
플래그:바이트;
요일:단어;
시작하다
플래그:=gLunarHolDay[(iYear-START_YEAR)*12+iMonth-1];
ifiDay<15then
일:=15-((Flagshr4)및$0f)
또 다른
일:=(플래그 및$0f)+15;
ifiDay=Daythen
ifiDay>15그때
결과:=(iMonth-1)*2+2
또 다른
결과:=(iMonth-1)*2+1
또 다른
결과:=0;
끝;
functionGetLunarHolDay(InDate:TDateTime):string;
var
i,iYear,iMonth,iDay:Word;
시작하다
DecodeDate(InDate,iYear,iMonth,iDay);
i:=l_GetLunarHolDay(iYear,iMonth,iDay);
케이스오프
1:결과:='샤오한';
2:결과:='큰 추위';
3:Result:='봄의 시작';
4:결과:='비';
5:결과:='징저';
6:결과:='춘분';
7:결과:='칭밍';
8:결과:='구유';
9:결과:='여름의 시작';
10:결과:='샤오만';
11:결과:='새끼종';
12:Result:='하지';
13:결과:='약간의 열기';
14:결과:='더위';
15:Result:='가을의 시작';
16:결과:='히트 종료';
17:Result:='흰이슬';
18:결과:='추분';
19:결과:='차가운 이슬';
20:결과:='프로스트';
21:Result:='겨울의 시작';
22:결과:='샤오쉬';
23:결과:='폭설';
24:Result:='동지';
또 다른
l_CalcLunarDate(iYear,iMonth,iDay,CalcDateDiff(InDate,EncodeDate(START_YEAR,1,1)));
결과:=trim(FormatMonth(iMonth)+FormatLunarDay(iDay));
끝;
끝;
functionGetLunarHolDay(iYear,iMonth,iDay:Word):string;
시작하다
결과:=GetLunarHolDay(EncodeDate(iYear,iMonth,iDay));
끝;
끝.