Os dois famosos algoritmos para a geração de datas julianas

21/05/2003

0

Procedure JuliandateToDate(juliandate:Integer);
var day,month,year:integer;
Begin
Year := INT((4 * JulianDate - 1) / 1461);
Day := (4 * JulianDate - 1) - (1461 * Year);
Day := INT((Day + 4) / 4);
Month := INT((5 * Day - 3) / 153);
Day := 5 * Day - 3 - 153 * Month;
Day := INT((Day + 5) / 5);
IF Month < 10 THEN
Month := Month + 3;
ELSE
Begin
Month := Month - 9;
Year := Year + 1;
End;
End;

procedure DateToJulianDate(day,month,year:Integer);
var juliandate:Integer;
Begin
IF Month <= 2 THEN begin
Month := Month + 9;
Year := Year - 1;
end
ELSE
begin
Month := Month - 3;
End;
JulianDate := INT((1461 * Year) / 4) + INT((153 * Month + 2) / 5) + Day;
End;


Carnette

Carnette

Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar