English
Source / code snippets

week-day from date to charge: "Zeller´s Kongruenz"

 

p.specht

sometimes would like one know, on whom week-day one bestimmtes date falls. there Wochentage from the Gregorianischen Kalenderreform 1582 unbeeinflußt stayed, think one itself, the be right simply. however: others Schaltjahresregeln as well as a 10-tägige Anpassungsperiode (on thursday, whom 4. october 1582 followed same friday, the 15. october) komplizieren The Berechnung directly a Datumsangabe.

a tauglichen Algorithmus owe we Herrn priest Christian Zeller, priest and Mathematiker, which "ZELLER´s KONGRUENZ" erstmals 1882 published watts.

here a quick-n-dirty Umsetzung without large Plausibilitätsprüfung in XProfan 11.2a. Einstellige indicated are thereby with vorangestellter 0 zweistellig type. Separator not forget!
' Zellers Kongruenz, Version 1.02, without each Gewähr
Window Title "Direkte Wochentagsermittlung from Datum"
declare there$,dy%,mnth%,fyear%,syear%,kal$,i%,j%,h%,greg%
Window 424,300
again:
cls rgb(0,100,255)
print
print " Algorithmus " + chr $(34) + "Zeller´s Kongruenz" + chr $(34) + "                  "
print " fountain: priest Dr. Christian Zeller, A.D.1882 "
print
print " date [dd.mm.yyyy] = ";
locate 5,24 : input there$
case there$="" : end
dy%=val(left$(there$,2))
mnth%=val(mid$(there$,4,2))
fyear%=val(mid$(there$,7,4))
syear%=val(mid$(there$,9,2))
print
print

if fyear% > 1582 : greg%=1

elseif fyear% < 1582 : greg%=0

elseif fyear% = 1582

    if mnth%>10 : greg%=1

    elseif mnth%<10 : greg%=0

    elseif mnth%=10

        if dy%>=15 : greg%=1

        elseif dy%<=4 : greg%=0

        else

            greg%=-1

        endif

    endif

endif

kal$=" Julianischer Calendar 45vChr-4.10.1582  "
case greg%=1 : kal$=" Gregorianischer Calendar              "
case greg%=-1: kal$=" KEIN CALENDAR ZUFREFFEND!             "
Print kal$
Print " The " + st$(dy%)+"."+st$(mnth%)+"."+st$(fyear%)+" falls on a ";

if mnth%<3

    mnth%=mnth%+12
    fyear% = fyear%-1
    syear% = syear%-1

endif

h%=-1

if greg%=1

    h%=(dy%+int((mnth%+1)*26/10)+syear%+int(syear%/4)+int( int(fyear%/100) /4) + 5*int(fyear%/100) ) mod 7

elseif greg%=0

    h%=(dy%+int((mnth%+1)*26/10)+syear%+int(syear%/4)+ 5 + 6* int(fyear%/100) ) mod 7

else

    h%=99

endif

if h%=0 : print "Samstag";

elseif h%=1 : print "Sonntag";

elseif h%=2 : print "Montag";

elseif h%=3 : print "Dienstag";

elseif h%=4 : print "Mittwoch";

elseif h%=5 : print "Donnerstag";

elseif h%=6 : print "Freitag";

elseif h%=99: print "        "

    print " not existierenden period (because of   "
    print " grego. Kalenderreform boisterously)";
    else : print " fehlerhaften Eingabewert";

endif

print ".   "
WaitInput
Goto "nochmal"
 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
04/11/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

825 Views

Untitledvor 0 min.
N.Art07/23/21
Glubbfan06/19/21
Uwe ''Pascal'' Niemeier06/13/21
Walter04/25/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie