Treatment of Delphi to the lunar calendar

zhaozj2021-02-17  46

Treatment of Delphi to the lunar calendar

Boymaster

Summary: Guan calendar to the lunar conversion Keyword: calendar, lunar calendar, conversion category: Object Pascalunit Calfunc; interfaceuses sysutils, windows; const start_year = 1901; end_year = 2050; // Return Iyear Year IMONTH monthly day 1 year - January - - 6 5535 Function Monthdays (Iyear, IMONTH: WORD): Word; // Return the number of days of the lunar calendar ilunaryer Year, if ilunarmonth is the month, // high-character is the second iLunarmonTH day, otherwise high words For 0 1901 - December 2050, Function Lunarmonthdays (Ilunaryear, Ilunarmonth: Word): Longword; // Returns the total number of iluna ilunaryear years in January 1901 - December 2050 Function LunaryEardays (Ilunaryear: Word; word; // Return the lunar month of the ilunaryear year, if there is no return 0 from January 1901 - December 2050 Function Getleapmonth (Ilunaryear: Word): Word; // Format the Iyear Year into Tianke's Year string procedure FormatLunarYear (iYear: Word; var pBuffer: string); represents a method overload; function FormatLunarYear (iYear: Word): string; overload; // iMonth the formatted string Chinese procedure FormatMonth (iMonth: Word; var pBuffer : string; bLunar: Boolean = True); overload; function FormatMonth (iMonth: Word; bLunar: Boolean = True): string; overload; // iDay the formatted string Chinese procedure FormatLunarDay (iDay: Word; var pBuffer: string ); overload; function formatlunarday (iDay: word): string; overload; // calculate two During the day period, the number of days of the day will be 1 year from January 1, 65535, Function Calcdatediff (Indyear, IENDMONTH, IENDDAY: WORD; istartyear: Word = Start_Year; iStartMonth: Word = 1; iStartday: word = 1): Longword; overload; function calcdate: tdatetime: longword; overload; // calculate the Queen Iyear Year IMONTH Mon Valenda, return to the corresponding lunar calendar, 0-24 // January 1, 1901 - - December 31, 2050 Function Getlunarholday (InDate: tdatetime): String; Overload; Function Getlunarholday (Iyear, IMONTH, IDAY: WORD): String; Overload; // private function -------------------------------------------------------------------------- ---------------------------- // Calculate the l_calclunardate (var Iyear,) from January 1, 1901. IMONTH, IDAY: WORD; ispandays: longword); // Calculate the Physical Calear Iyear Year IMONTH Month Iday Day corresponding to the throttle 0-24,

0 Table is not a function l_getlunarholday (Iyear, IMONTH, IDAY: WORD): Word; import; import; importationvar //Rroup GLUNARDAY deposits the number of monthly months in the middle of the annual monthly calendar 1901 to 2100, // The lunar calendar can only be 29 or 30 days. According to 12 (or 13) binary positions, the corresponding position is 1 table 30 days, otherwise 29 days glunarmonthday: array [0..149] of Word = (// Test data is only 1901.1.1 --2050.12 .31 $ 4AE0, $ A570, $ 5268, $ 560, $ 9AD0, $ 4AE8, $ 4AE0, / / ​​1910 $ A4D8, $ A4D0, $ D250, $ D548, $ B550, $ 56 A0, $ 96D0, $ 95B0, $ 49B8, $ 49B0, / / ​​1920 $ A4B0, $ B258, $ 2B60, $ 9570, $ 4978, $ 4970, $ 64B0, / / ​​1930 $ D4A0, $ EA50, $ 6D48, $ 5AD0, $ 92E0, $ C968, $ C950 $ D4A0, / / ​​1940 $ DA50, $ AAD8, $ 25D0, $ 92D0, $ C958, $ A950, $ B4A8, $ 55A8, $ 4DA0, $ A5B0, $ 52B8, $ 52B0, $ A950, $ E950, $ 6AA0, $ AD50, / / ​​1960 $ AB50, $ 4B60 $ A570, $ A570, $ 5260, $ 5AA8, $ 56A0, $ 96D0, / 1970 $ 4AE8, $ 4AD0, $ A4D0, $ D268, $ D250, $ D528, $ B540, $ B6A0 $ 96D0, $ 95B0, / / ​​1980 $ 49B0, $ A4B8, $ 6D40, $ ADA0, $ AB60, $ 9370, $ 4978, / / ​​1990 $ 4970, $ 64B0, $ 6A50 $ 5A50, $ AB60, $ 9368, $ 92E0, $ C960, / / ​​2000 $ D4A8, $ 5A8, $ 56A0, $ AAD8, $ 25D0, $ 92D0, $ C958 $ A950, / / ​​2010 $ B4A0, $ B550, $ 550, $ 55A8, $ 52B8, $ 52B0, $ A930, $ 74A8, / / ​​2020 $ 6AA0, $ AD50, $ 4DA8, $ 4 B60, $ 9570, $ A4E0, $ D260, $ E930, $ 6B 50, $ 96D0, $ 4AE8, $ 4AD0, $ A4D0, $ D258, $ D250, $ D520, $ DAA0, $ D520, $ DAA0, $ B5a0, // 2040 $ 56D0, $ 4AD8, $ 49B0, $ AA50, $ B528, $ 6D20, $ ADA0, $ 55B0); // 2050 // A group Glanarmonth Store 阴 历 1901 to 2050 The month of the moon, if it is 0, each word, two years, Glunarmonth: Array [0..74] of byte =

($ 00, $ 50, $ 04, $ 05, $ 00, $ 20, $ 70, //920 $ 05, $ 00, $ 40, $ 00, $ 50, $ 03, $ 07, $ 00, //940 $ 60, $ 70, //950 $ 05, $ 00, $ 30, $ 40, $ 03, $ 07, $ 00, // 1970 $ 50, $ 04, $ 08, $ 00, $ 00, //980 $ 00, $ 05, //990 $ 00, $ 30, $ 40, $ 02, $ 07, $ 00, $ 50, // 2010 $ 04, $ 09, $ 00 $ 60, $ 04, //2020 $ 00, $ 2030 $ 30, $ B0, $ 06, $ 00, $ 0. // 204 $ 02, $ 07, $ 00, $ 50, $ 03); // 2050 / / A number of Glanarholiday stores the twenty-four hollow calendar dates per year // The twenty-fourth hollow calendar is almost fixed, and the average distribution in 12 months / / January 200. April 6, 6 Month // Small cold, spring, rain, spring, spring, spring, spring, summer, summer, summer, summer, Summer, //, 7 months, September, September, September, September, September, September, September, September, September, Summer, Summer *********************************************************** ************************ No determination rules without any determination, so there is only a space to save space, so ... ***** *********************************************** ************************************************} // Data format Description: // In 1901 Shanning to // January SEAL 18 SEIME $ 1 September September 11, September 1, September //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 // The first line of data above is the monthly hollow corresponding date, 15 minus the first holiday , The second holiday is reduced to 15, the second row is // This monthly, the two flying corresponding data is less than 16, and the first byte is stored in one byte, the first air data is stored, and the low storage // second Data of a hollow, you can get the following mesholday: array [0..1799] of byte =

($ 96, $ 97, $ 78, $ 79, $ 79, $ 96, $ A4, $ 96, $ 96, $ 97, $ 87, $ 79, $ 79, $ 79, $ 69 $ 78, $ 78, $ 96, $ 87. $ 87, $ 79, $ 69,// 1903 $ 86, $ A5, $ 96, $ A5, $ 96, $ 97, The $ 88,96,96,// 1904 $ 96, $ 97, $ 978, $ 79, $ 79, $ 69,96, $ 77, $ A4, $ 96 $ 96, $ 79, $ 79, $ 69, $ A57, $ 87, $ 69, $ 69, $ 69, $ 78, $ 78, // 1907 $ 86, $ 96, $ 97, $ 88, $ 87, //908 $ 96, $ 97, $ 78, $ 79, $ 79, $ 69 $ 78, $ A4, $ 96, $ 79, $ 79, $ 69,96, $ 78, //910 $ 96, $ 87, $ 87, $ 87, $ 79 $ 69, $ 78, //911 $ 86, $ 97, $ 88, $ 78, $ 78, $ 69, $ 95, $ b4, $ 96, $ A6, $ 97, $ 79, $ 69, $ 78, $ 96, $ A6, $ 97, $ 97, $ 79, $ 79, $ 79, $ 69, $ 78, $ 78, //914 $ 96, $ 97, $ 97, $ 79, $ 69,15 $ 96, $ A5, $ 96, $ A5, $ 96, $ 97, $ 88, $ 78, $ 78 $ 79,16 $ 95, $ B47, $ 78, $ 79, $ 78, $ 69, $ 96, $ B4, $ 96, $ A6, $ 97 $ 97, $ 69, $ 78, $ 77, //918 $ 96, $ a # 87, $ 79, $ 69, $ 69, $ 78, $ 78, / / ​​1919 $ 96, $ A5 $ 96, $ A5, $ 78, $ 79, $ 95, $ B4, $ 78, $ 79, $ 78, $ 69, $ 78, $ 87 $ B421 $ 96, $ 97, $ 79, $ 79, $ 79, $ 69,96, $ A4, $ 96, $ 96, $ 97, $ 87, $ 79, $ 79, $ 69,/ 1923 $ 96, $ A5, $ 96, $ 78, $ 78, $ 79, $ 77, $ 87, / / ​​1924 $ 95, $ B4, $ 96,

$ A5, $ 96, $ 78, $ 78, $ 87, //925 $ 96, $ 97, $ 78, $ 79, $ 79, $ 69, $ 78, $ 77, // $ 96, $ A4, $ 96, $ 79, $ 79, $ 69,96,5,, $ 96, $ 88, $ 96, $ 96, $ 88, $ 78, $ 78, $ 78 $ 87, $ 96, $ A5, $ 96, $ 97, $ 88, $ 87, //929 $ 96, $ b4, $ 96, $ a6, $ 97, $ 97 $ 78, $ 78, $ 77, //930 $ 96, $ A4, $ 87, $ 79, $ 79, $ 79, $ 69, $ 78, $ 78, / / ​​1931 $ 96, $ A5, $ 96 $ A58, $ 96, $ 78, $ 87, $ 9632 $ 95, $ 97, $ 88, $ 78, $ 78, $ 69, $ 78, $ 87, / / 1933 $ 96, $ 97, $ 78, $ 79, $ 79, $ 69,96, $ A4, $ 96, $ 96, $ 97, $ 97, $ 79, $ 79, $ 79, $ 69,35,56,5,,, $ 988, $ 78, $ 78, $ 78, $ 87, $ 87, //936 $ 95, $ B4, $ 96, $ A5, $ 96, $ 97, # $ 78, $ 87, //937 $ 96, $ 97, $ 78, $ 79, $ 79, $ 69, $ 78, $ 77, //938 $ 96, $ a 4, $ 97, $ 79, $ 79, $ 69 $ 78,96,5,, $ 88, $ 78, $ 78, $ 78, $ 87, $ 87 $ 940 $ 95, $ 97, $ 88, $ 78, $ 78, $ 996, $ B4, $ 96, $ A6, $ 97, $ 97, $ 78, $ 79 $ 79,/ 1942 $ 96, $ A4, $ 79, $ 79, $ 79, $ 69, $ 78, $ 78, / / ​​1943 $ 96, $ A5, $ 96, $ A5, $ A6, $ 96, $ 78, $ 87, $ 9644, $ 96, $ 97, $ 88, $ 78, $ 87, $ 79, $ 77, $ 87, / / ​​1945 $ 95 $ 97, $ 97, $ 78, $ 79, $ 78, $ 96, $ B49, $ 79, $ 79, $ 79, $ 69, $ 78,5, $ A6, $ A58, $ 88, $ 78, $ 78, $ 87, $ 87, //948 $ A5, $ B4, $ 96, $ A5, $ 96 $ 97, $ 88,

$ 79,97, //949 $ 95, $ 97,96, # 79,97, $ 78, $ 78, $ 78, $ 99,96, $ b4, $ 96, $ A6, $ 97, $ 97, $ 79,96,951 $ 96, $ A5, $ A6, $ 88, $ 88, $ 78, $ 78, $ 87, $ 87, / US $ 882 $ A5, $ 97, $ 88, $ 78, $ 78, $ 95, $ B4, $ 96, $ 78, $ 96, $ 97, $ 78, $ 79, $ 78, $ 684 $ 96, $ 97, # 78, $ 79, $ 79, $ 69,96, $ 77, //955 $ 96, $ A5, $ A5, $ A5 $ A6, $ 96, $ 87, $ 87, / 1956 $ A5, $ B4, $ 88, $ 78, $ 78, $ 79, $ 77, $ 87, // $ 95,95, $ 97, $ 88, $ 87, $ 7888 $ 96, $ B4, $ 97, $ 78, $ 79, $ 79, $ 69,96,96, $ a6, $ 96, $ 88, $ 87, //960 $ A5, $ B4, $ 96, $ A5 $ 96, $ 96, $ 78, $ 87, $ 96661 $ 96, $ 97, $ 88, $ 78, $ 78, $ 69, $ 78, $ 87, / / ​​1962 $ 96 $ B4, $ 96, $ A6, $ 97, $ 9 79, $ 69, $ 78, $ 77, $ A58, $ A6, $ 96, $ 88, $ 88, $ 88, $ 78, $ 87, $ 87, / / ​​1964 $ A5 $ B4, $ 96, $ 88, $ 87, //965 $ 95, $ 5,96,5, $ 96, $ 97, $ 88, $ 78, $ 78, $ 69, $ 78,57, //966 $ 97, $ 97, $ 78, $ 79, $ 79, $ 69,96, $ a4, $ A5, $ A5, $ A6, $ A6, $ 88, $ 87, $ 87, //968 $ A5, $ 5, $ 88, $ 78, $ 78, $ 78, $ 87, $ 87, / / ​​1969 $ 95, $ B4, $ 96, $ 88, $ 87, //970 $ 96, $ b4, $ 78, $ 79, $ 79, $ 69, $ 78 $ 77, //971 $ A6, $ A6, $ 88, $ 88, $ 88, $ A57, $ B5, $ 96, $ A5, $ A5, $ A6, $ 96, $ 88, $ 78, $ 78, $ 78, $ 87,

$ 87, //973 $ 96, $ 97, $ 88, $ 78, $ 87, //974 $ 96, $ b4, $ 96, $ A6, $ 97, $ 97, $ 78, $ 79,47, //975 $ 96, $ A6, $ 88, $ 89, $ 88, $ 78, $ 87, $ 87, / / ​​1976 $ A5, $ B4 $ 96, $ A58, $ 78, $ 78, $ 95, $ B4, $ 88, $ 78, $ 78, $ 79, $ 78, $ 87 $ 978 $ 96, $ 97, $ 78, $ 79, $ 78, $ 69,96, # a4, $ A5, $ B5, $ A6, $ A6, With $ 88,5,///980 $ A5, $ B48, $ 88, $ 87, $ 78, $ 77, $ 87, / / ​​1981 $ 95, $ B4 $ 96, $ A58, $ 78, $ 79, $ 95, $ B4, $ 78, $ 79, $ 78, $ 69, $ 78, $ 77 $ B483 $ B58, $ A6, $ 87, $ 88, $ 88, $ 78, $ A5, $ B4, $ A6, $ A5, $ A6 $ 96, $ 88, $ 87, $ 87, //985 $ 96, $ 97, $ 88, $ 78, $ 78, $ 79, $ 77, $ 87, // 1986 $ 95, $ B4, $ 97, $ 88, $ 79, $ 78, $ 6 9. $ 78, $ 96, $ B4, $ A57, $ 88, $ 88, $ 78, $ 87, $ 86, / / ​​1988 $ A5, $ B4, $ A5, $ A58, $ 88, $ 78, $ 87, $ 87, //989 $ a5, $ 96, $ 88, $ 78, $ 78, $ 79, $ 77, $ 87, //990 $ 95, $ B4, $ 88, $ 78, $ 78, $ 69,96, $ B4, $ A5, $ B5, $ A6, $ A6, $ 87 $ 88, $ 86, $ A58, $ A6, $ 96, $ 88, $ 88, $ 88, $ 78, $ 87, $ 87, / / ​​1993 $ A5, $ B4, $ 96, $ 88, $ 78, $ 78, $ 95, $ B4, $ 96, $ 76, $ 78, $ 69, $ 78, $ 87, //995 $ 588,4, $ A6, $ 87, $ 86, //996 $ A5, $ B3, $ A5, $ A5, $ A5, $ A6, $ A6, $ 88, $ 88, $ 88, $ 78, $ 87, $ 87, / / ​​1997 $ A5,

$ B4, $ 96, $ 87, $ 87, //998 $ 95, $ b4, $ 96, $ 78, $ 78, $ 69, $ 78 $ 87, //999 $ a6, $ A6, $ 87, $ 88, $ 88, $ A5, $ B3, $ A5, $ A5, $ A6, $ A6, $ 88, $ 87, // 2001 $ A5, $ B4, $ 88, $ 78, $ 78, $ 78, $ 87, $ 87, // $ 95, $ B4, $ 97, $ 88, $ 78, $ 78, $ 96, $ B4, $ A5, $ B57, $ A6, $ A6, $ 87, $ 88 $ 88, $ 78, $ A5, $ B3, $ A58, $ 88, $ 88, $ 78, $ 87, $ 87, / / ​​2005 $ A5, $ B4 $ 96, $ A58, $ 87, $ 78, $ 95, $ B4, $ 96, $ 78, $ 78, $ 69, $ 78, $ 87, $ A5, $ B58, $ A6, $ 87, $ 86, $ 78, $ 87, $ B3, $ A5, $ B5, $ B5, $ A6, $ A6, $ 88, $ 87, // 2009 $ A5, $ B4, $ 96, $ 88, $ 78, $ 78, $ 87, $ 87, // 2010 $ 95, $ B48, $ 88, $ 78, $ 78, $ 79, $ 78, $ 87, // 2011 $ 96, $ A57, $ A6, $ 87, $ 86, //2 $ A5, $ B3, $ A5, $ B5, $ A6, $ A6, $ 87, $ 87, $ 87, //3 $ A5, $ B4, $ 96, $ 88, $ 78, $ 78, $ 87, $ 87, // 2014 $ 95, $ B4 $ 96, $ A58, $ 87, $ 79,95, $ B4, $ A57, $ 88, $ A6, $ 87, $ 88, $ 87, $ 78, $ 87,56, $ A5, $ B5, $ A6, $ A6, $ 87, $ 87, // 2017 $ A5, $ B4, $ A6, $ A6, $ A5, $ A6, $ 96, $ 87, $ 87, //20 $ a5, $ b4, $ 88, $ 96, $ 96, $ 88, $ 78, $ 78, $ 79, $ 77, $ 87, / Our $ 95,95,57,57, $ 97, $ 86, //2020 $ A5, $ C3, $ A5, $ B5, $ A6, $ A6, $ A6, $ 87, $ 88, $ 88, $ 78, $ 87, $ 86, //2021 $ A5, $ B4, $ A5, $ A5, $ A6,

$ 96,98, $ 87, $ 87, //2022 $ A5, $ B4, $ 88, $ 78, $ 78, $ 79, $ 77, $ 87, //2023 $ 95, $ B4, $ A5, $ 87, $ 87, $ 78, $ 87, $ C3, $ A5, $ B5, $ A6, $ A6, $ 87, $ 88 $ 88, $ 78, $ A5, $ B3, $ A58, $ 88, $ 88, $ 78, $ 87, $ 87, //2026 $ A5, $ B4 $ 96, $ A578, $ 78, $ 78 $ 95, $ B4, $ 97, $ 87, $ A6, $ 97, $ 87, $ 87, $ 78, $ 87, $ C3, $ A5, $ B5, $ A6, $ A6, $ 87, $ 86, //2029 $ A5, $ B3, $ A5, $ A5, $ A5, $ A6, $ A6, $ 88, $ 87, $ 8830 $ A5, $ B46, $ 88, $ 78, $ 78, $ 78, $ 87, $ 87, // 2031 $ 95, $ A6, $ 97, $ 87, $ 87, $ 78, $ 87, $ C3, $ A5, $ B5, $ A6, $ A6, $ 88, $ 87, $ 86, //2033 $ A5, $ B3, $ A6, $ 88, $ 78, $ 88, $ 78, $ 87, $ 87, // 2034 $ A5, $ B4, $ 96, $ 88, $ 87, $ 7835 $ 95, $ B4, $ A5, $ B 4, $ A57, $ 78, $ 87, $ 96, //2036 $ A5, $ C3, $ A5, $ B58, $ 88, $ 78, $ 87 $ 86, // 2037 $ A5, $ A6, $ 88, $ 88, $ 88, $ 78, $ 87, $ 87, //2038 $ A5, $ B4, $ 96, $ A5, $ A6, $ 96, $ 78, $ 87, //2039 $ 95, $ B4, $ A5, $ 87, $ 87, $ 78, $ 87, $ 96, / US $ A5, $ C3, $ A6, $ 87, $ 88, $ 87, $ 7841 $ A5, $ B3, $ A5, $ B5, $ A6, $ A6, $ 88, $ 87, $ 87, $ B4, $ 88, $ 88, $ 78, $ 78, $ 87, $ 87, //2043 $ 95 $ B4, $ A6, $ 97, $ 87, $ 87, $ A57, $ C3, $ A5, $ B4, $ A5, $ A6, $ 87 $ 88, $ 86, $ 7845 $ A5, $ B3, $ A5, $ 2, $ A6, $ A6, $ 87, $ 88, $ 88,

$ 7846 $ A5, $ B4, $ 88, $ A6, $ 96, $ 87, $ 87, //2047 $ 95, $ B4, $ A5, $ B4 $ A5, $ A58, $ 86, $ 96, / 2048 $ A4, $ C3, $ A5, $ 97, $ A57, $ 87, $ 78, $ 87, $ 86, //2049 $ A5, $ C3, $ A5, $ 87, $ 87); // 2050Function Monthdays (Iyear, IMONTH: WORD): Word; Begin Case IMONTH OF 1,3,5,7,8,10,12: result: = 31; 4, 6, 9, 11: Result: = 30; 2: // If it is a leap year if isleApyear (Iyear) Then Result : = 29 else result: = 28 else result: = 0; end; end; function getleapmonth (iLunaryear: word): Word; var flag: Byte; Begin Flag: = Glunarmonth [(ilunaryear-start_year) Div 2]; if (IF iLunarYear-START_YEAR) mod 2 = 0 then Result: = Flag shr 4 else Result: = Flag and $ 0F; end; function LunarMonthDays (iLunarYear, iLunarMonth: Word): Longword; var Height, Low: Word; iBit: Integer; begin If ilunaryear g etLeapMonth (iLunarYear)) and (GetLeapMonth (iLunarYear)> 0) then Dec (iBit); if (gLunarMonthDay [iLunarYear-START_YEAR] and (1 shl iBit))> 0 then Inc (Low); if iLunarMonth = GetLeapMonth (iLunarYear) THEN IF (GlunarmonTHDAY [ilunaryear-start_year] and (1 shl (iBIT-1)))> 0 THEIGHT: = 30 else Height: = 29; Result: = makelong (low, height); end; function lunaryeardays (ilunaryear: Word; word; var days, i: word; tmp: longword; begin days: = 0; for i: = 1 to 12 do begin tmp: = lunarmonthdays (ilunaryear,

i); days: = days half; days: = days loword (tmp); end; result: = days; end; procedure formatlunaryear (Iyyear: Word; var pBuffer: string); var sztext1, sztext2, SzText3: String; Begin Sztext1: = 'Methyl 乙 丁 丁 庚 庚 壬'; sztext2: = 'Zhen ugly 寅 卯 巳 巳 未 酉 亥'; sztext3: = 'rat Niuhu Free Dragon Snake Pigher Chicken Chicken Pig'; 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 'Year'; End; Function FormatlunaryEar (Iyear: Word): String ; var pBuffer: string; begin FormatLunarYear (iYear, pBuffer); Result: = pBuffer; end; procedure FormatMonth (iMonth: Word; var pBuffer: string; bLunar: Boolean); var szText: string; begin if (not bLunar) and (IMONTH = 1) THEN BEGIN PBUFFER: = 'Jan'; EXIT; End; Sztext: = 'Positive Twenty Four Fifth orif Y890; if IMONTH <= 10 Then Begin PBuffer: ='; PBuffer: = PBUFFER COPY (IMONTEXT, (IMONTH-1) * 2 1, 2); PBuffer: = PBuffer 'Moon'; EXIT; End; if IF IMONTH = 11 THEN PBUFFER: = 'Else PBuffer: =' 10 2 '; pBuffer: = PB uffer 'month'; end; function FormatMonth (iMonth: Word; bLunar: Boolean): string; var pBuffer: string; begin FormatMonth (iMonth, pBuffer, bLunar); Result: = pBuffer; end; procedure FormatLunarDay (iDay: Word; VAR PBUFFER: STRING; var sztext1, sztext2: string; begin sztext1: = 'early ten 廿 三'; sztext2: = 'one or two three four five six seven eight ninetyses; if (iDay <> 20) and (iDay <> 30) The begin PBuffer: = COPY (Sztext1, ((iDay-1) Div 10) * 2 1, 2); PBuffer: = PBuffer Copy (Sztext2, ((iDay-1) MOD 10) * 2 1,

2); END ELSE BEGIN PBUFFER: = COPY (IDAY DIV 10) * 2 1, 2); PBuffer: = PBuffer 'Ten'; End; End; Function FormatLunarday (iDay: Word): string; var pBuffer : string; begin FormatLunarDay (iDay, pBuffer); Result: = pBuffer; end; function CalcDateDiff (iEndYear, iEndMonth, iEndDay: Word; iStartYear: Word; iStartMonth: Word; iStartDay: Word): Longword; begin Result: = Trunc ( EncodeDate (iEndYear, iEndMonth, iEndDay) -EncodeDate (iStartYear, iStartMonth, iStartDay)); end; function CalcDateDiff (EndDate, StartDate: TDateTime): Longword; begin Result: = Trunc (EndDate-StartDate); end; procedure l_CalcLunarDate (var Iyear, IMONTH, IDAY: WORD; ispandays: longword; var tmp: longword; begin // Cumulatory calendar February 19, 1901, for the lunar calendar 1901, first month, first month, January 1, 1901 to February 19th 49 days if ispandays <49 death = start_year-1; if ispandays <19 dam = 11; iDay: = 11 word (ispandays); end else begin = 12; iday: = word (ispandays ) -18; End; EXIT; END; // below the lunar calendar 1901, ISPANDAYS: = ISPANDAYS-49; IYEAR: = start_year; iMon TH: = 1; iDay: = 1; // Computing Year TMP: = LunaryEardAys (Iyear); while ispandays> = Tmp Do Begin ISPAndays: = ISPANDAYS-TMP; INC (IYEAR); TMP: = LunaryEardAys (Iyear); END ; // calculate the monthly tmp: = LoWord (LunarMonthDays (iYear, iMonth)); while iSpanDays> = tmp do begin iSpanDays: = iSpanDays-tmp; if iMonth = GetLeapMonth (iYear) then begin tmp: = HiWord (LunarMonthDays (iYear, IMONTH)); if ispandays

转载请注明原文地址:https://www.9cbs.com/read-29645.html

New Post(0)