Советы по Delphi

         

Вычисление даты


Вычисление даты Пасхи
function TtheCalendar.CalcEaster:String;
var B,D,E,Q:Integer;
GF:String;begin
B:=225-11*(Year Mod 19);D:=((B-21)Mod 30)+21;If D>48 then Dec(D);E:=(Year+(Year Div 4)+D+1)Mod 7;Q:=D+7-E;If Q<32 then beginIf ShortDateFormat[1]='d' thenResult:=IntToStr(Q)+'/3/'+IntToStr(Year)
else Result:='3/'+IntToStr(Q)+'/'+IntToStr(Year);endelse beginIf ShortDateFormat[1]='d' thenResult:=IntToStr(Q-31)+'/4/'+IntToStr(Year)
else Result:='4/'+IntToStr(Q-31)+'/'+IntToStr(Year);end;{вычисление страстной пятницы}If Q<32 then beginIf ShortDateFormat[1]='d' then GF:=IntToStr(Q-2)+'/3/'+IntToStr(Year)else GF:='3/'+IntToStr(Q-2)+'/'+IntToStr(Year);endelse beginIf ShortDateFormat[1]='d' thenGF:=IntToStr(Q-31-2)+'/4/'+IntToStr(Year)
else GF:='4/'+IntToStr(Q-31-2)+'/'+IntToStr(Year);end;
end;
[000009]


Содержание раздела