Einzelnen Beitrag anzeigen

Benutzerbild von Wolfgang Mix
Wolfgang Mix

Registriert seit: 13. Mai 2009
Ort: Lübeck
1.222 Beiträge
 
Delphi 2005 Personal
 
#4

Re: Gregorianischer Tag - Gregorianisches Datum

  Alt 2. Aug 2009, 16:52
Habe die Funktion GregorToStr noch einmal vereinfacht.
Sie heißt jetzt GregorToDate und gibt jetzt statt einem String einen Datumswert zurück.

Delphi-Quellcode:
//Wolfgang Mix - Delphi-Praxis
//Returns date of a Gregorian day number; 1 = 1582-10-15; 152385 = 2000-1-1
function GregorToDate(n:longint):TDate;
begin
  if (n >= 1) and (n <= 3074324) then
    Result := n - 115859
  else
    raise Exception.CreateFmt('GregorToDate(%d) - invalid n', [n])
end;


Label1.Caption:=DateToStr(GregorToDate(152385)); // 2000-01-01
Wolfgang Mix
if you can't explain it simply you don't understand it well enough - A. Einstein
Mein Baby:http://www.epubli.de/shop/buch/Grund...41818516/52824
  Mit Zitat antworten Zitat