Sign in Join
Wiki copytemporary

leap year/de

Zurück zur Seite Code Beispiele.

Dieses Beispiel prüft, ob das Jahr ein (christliches) Schaltjahr ab dem Jahr 1582 ist.

Alternativ gibt es dazu in der Unit Sysutils die Funktion leap year (leap year = Schaltjahr).

pascal
function funIstSchaltjahr(wrdJahr: word): integer;
const
  conKalenderumstellung = 1583;
  conFehler = -1;
  conFalsch = 0;
  conWahr = 1;

begin

  Result := conFehler;
  // Prüft auf die Richtigkeit des Kalenderjahres
  if wrdJahr < conKalenderumstellung then
    exit;

  Result := conFalsch;

  if (wrdJahr mod 4) = 0 then
    Result := conWahr;
  if (wrdJahr mod 100) = 0 then
    Result := 0;
  if (wrdJahr mod 400) = 0 then
    Result := conWahr;

end;

See also

Talk:leap year/de


From the Free Pascal wiki, page "leap year/de", as it stood on 2020-02-19 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.