Показать сообщение отдельно
  #5  
Старый 12.09.2013, 11:29
Annihilator Annihilator вне форума
Прохожий
 
Регистрация: 16.06.2013
Сообщения: 29
Версия Delphi: Delphi XE 2
Репутация: 10
По умолчанию

После беглого прочтения про юлианскую дату и её расчёт, я так понимаю что должно быть что-то типа такого:
Код:
unit uMain;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    function JDday(const year, month, day:integer):integer;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
  memo1.Lines.Add(IntToStr(JDday(2013, 9,12)));
end;

function TForm1.JDday(const year, month, day: integer): integer;
var
  a, y, m:integer;
begin
   a:= trunc((14 - month) / 12);
   y:= year + 4800 - a;
   m:= month + 12 * a - 3;
   result := day + trunc((153 * m + 2) / 5) + trunc(365 * y) + trunc(y / 4) - trunc(y / 100) + trunc(y / 400) - 32045;
end;

end.
Ну и далее надо дорабатывать всякие проверки дня, месяца на корректность и т.п.
Ответить с цитированием