Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Obtener Lunes de Carnaval o Jueves Santo (https://www.clubdelphi.com/foros/showthread.php?t=80745)

nemesio 06-07-2006 06:23:17

Obtener Lunes de Carnaval o Jueves Santo
 
Esta Función permite Obtener el Lunes de Carnaval o el Jueves Santo de un año específico.
Para Obtener la fecha del Lunes de Carnaval:
Festivo(Año,48);
Para Obtener la fecha del Jueves Santo:
Festivo(Año,3);
Para Obtener el Domingo de Resurrección o Pascua:
Festivo(Año,0);

Código Delphi [-]
function Festivo(Anno:Integer; Tipo:Integer):TDate;
var
  A,B,C,D,E,N:Integer;
  Dia,Mes:string;
begin
  A:=ANNO mod 19;
  B:=ANNO mod 4;
  C:=ANNO mod 7;
  D:=(19*A+24) mod 30;
  E:=(2*B+4*C+6*D+5) mod 7;
  N:=(22 + D + E);
  Mes:='03';
  if N>31 then
  begin
    N:=N-31;
    Mes:='04';
  end;
  Dia:=Trim(IntToStr(N));
  Dia:=StringOfChar('0', 2-Length(Dia) )+Dia;
  result:=StrToDate(Dia+'/'+Mes+'/'+IntToStr(Anno))-Tipo;

end;


La franja horaria es GMT +2. Ahora son las 14:33:43.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi