English
Source / code snippets

Berechnungen Calendar

 

Michael
Wodrich
unfortunately is into both subesquent functions yet the worm drin...
CompileMarkSeparation
Proc Date2Days

    Wandelt das Datum eine eine Anzahl von Tagen.
    Hiermit können Berechnungen leichter durchgeführt werden.
    Die Umkehrfunktion Days2Date() erstellt daraus wieder ein gültiges Datum.
    Parameters Date&
    Declare Century&,Year&,Month&,Day&
    Century& = @GetCentury(Date&)
    Year& = @GetYear(Date&)
    Month& = @GetMonth(Date&)
    Day& = @GetDay(Date&)

    If Month& > 2

        Sub Month&,3

    Else

        Add Month&,9

        If (Year&)

            Dec Year&

        Else

            Year& = 99
            Dec Century&

        EndIf

    EndIf

    Return @Int((146097 * Century&) / 4 + (1461 * Year&) / 4 + (153 * Month& + 2) / 5 + Day& + 1721119)

ENDPROC


CompileMarkSeparation
Proc Days2Date

    Wandelt a amount of Meet in one gültiges date circa.
    together with Date2Days() can so leichter Date Calculations implemented be.
    Parameters Days&
    Declare Century&,Year&,Month&,Day&
    Days& = Days& - 1721119
    Century& = (4 * Days& - 1) / 146097
    Days& = 4 * Days& - 1 - 146097 * Century&
    Day& = Days& / 4
    Year& = (4 * Day& + 3) / 1461
    Day& = 4 * Day& + 3 - 1461 * Year&
    Day& = (Day& + 4) / 4
    Month& = (5 * Day& - 3) / 153
    Day& = 5 * Day& - 3 - 153 * Month&
    Day& = (Day& + 5) / 5

    If Month& < 10

        Add Month&,3

    Else

        Sub Month&,9
        Inc Year&

        If Year& > 99

            Year& = 0
            Inc Century&

        EndIf

    EndIf

    Return @MakeDate(Century&,Year&,Month&,Day&)

ENDPROC


The functions should too data to 1583 correctly to charge.

on the 4.10.1582 followed by the Kalenderreform the 15.10.1582, it get means 10 days gestrichen, around the leap-year-Error again auszugleichen.

but very here runs the there- and zurückrechnen from the helms.

Denksportaufgabe?

MfG
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
06/07/04  
 




Michael
Wodrich
here the Original-statement.

i know The fountain unfortunately not any more. having I time from the internet simply in a Textdatei gegrabbt (unfortunately only this part):



Julianischer day
it were no year-2000-trouble, if any Programmer and computer The Julianische Tageszahl
for the date uses hätten. instead watts the year as Zeichenkette (TTMMJJ) stored and the
led moreover, that to 99 the year 00 comes. reason for zweistellige Speicherung the Jahreszahl was the
constraint to that Speichersparen. too here lying The Julianische Tageszahl in front, tappt im dunkeln had yet less memory
used.

The Julianische Tageszahl - or plainer the Julianische day - is a fortlaufende count the days,
beginnend with the day 0, the on the 1. january 4713 v. Chr. (in the proleptischen Julianischen Calendar) circa 12 watch
at noon began. accordingly begins one new Julianischer day too always circa 12 watch at noon,
what original for europäische astronomy whom benefit besaß, that any Beobachtungen of/ one night in a
only Julianischen day stattfanden.
The Julianische Tageszählung can itself through append the since 12 watch at noon verflossenen Tagesbruchteils slight
to a detailed Zeitangabe strain. so marks JD 2451605 whom day, the on the 1. March 2000 circa 12 watch begins,
during JD 2451605.25 whom Time circa 18 watch desselben Day certainly.

These expansion becomes in many founts as Julianisches date marks.

Julianische days get former in the rule (sofern nothing other specify watts) to mittlerer Sonnenzeit
counted, today to UT.
The Weltzeit or Universal time (UT) watts 1926 as Substitute for The Greenwich Mean time (GMT) introduced.
to this Time were several, to that part explicit different meanings of GMT in the use.

UT is for most virtually sue gleichzusetzen with the mittleren Sonnenzeit related on the Nullmeridian
of Greenwich.
alternatively get indicated too in Ephemeridenzeit made, what by the Bezeichnung JED or JDE
marked watts. too today is occasionally meaningfully, Julianische days in a others as the UT-Skala
anzugeben. The used Zeitskala is then on The Zeitangabe anzuhängen, z.B. as JD 2 451 545.0 TDT for
whom 1.january 2000, 12 watch at noon to TDT-Time.

often find itself too Zeitangaben in a modified Julianischen Datumsformat (MJD).
The gebräuchlichste Definition one MJD follows from MJD = JD - 2400000.5 the zero lying therefore
at 17. november 1858 circa 0 watch (!) Weltzeit.

others Definitionen existieren though too, so that with the usage of data in MJD caution geboten is.
from this Grunde becomes MJD too from the international Astronomischen Union not acknowledged.

The weight the Julianischen Tagesangabe in the present astronomy lying to that a in the Possibility of/ one
kompakten, eindeutigen Zeitangabe, to that others in the einfachen indicated and Berechnung of Zeitdifferenzen,
Perioden etc.

The Julianische Tageszählung watts 1581 from the french taught Joseph Justus Scaliger
(in its Werk Opus novum de emendatione temporum) introduced, circa a eindeutige Zeitzählung without negatives
Jahreszahlen to obtain. moreover had to the beginning the Zeitzählung sufficient far in the past tense in
vorhistorischen times lying. Scaliger engineering first of all a 7980 years währende Julianische period,
because it following Zyklen combined:

whom 28jährigen Sonnenzyklus, in the itself (in the Julianischen Calendar) The Kalenderdaten on the same
Wochentagen repeat (in the Gregorianischen Calendar would this Zyklus 400 years long);

whom 19jährigen Metonischen Zyklus, in the the Mondphasen and Finsternisse on almost the same
Kalenderdaten wiederholen; and

whom 15jährigen Indiktionszyklus, the in the Rome wealthy to Steuererhebung and census uses watts
and, beginnend with the 25.december 312 n.Chr, to fortlaufenden Datierung To into Today Time served.

the latest year, in the any three Zyklen together a new Durchlauf began, was 4713 v. Chr.
whom 1. january this year laid Scaliger as Beginn its Zeitrechnung solid. for the most Humans
the then epoch was this date though fiktiv, there to their believe The world first integral later
erschaffen watts. Scaliger self datierte The Erschaffung the world the year 3267 v.Chr.

The Algorithmus position itself then folgendermaßen dar:
Y = year, M = month (january = 1, february = 2, etc.),
D = day (possible with Tagesbruchteilen)

is M > 2 let Y and M unchanged.
is M = 1 or M = 2 then is
Y = Y - 1
M = M + 13

in the Gregorianischen Calendar rechnet one moreover:
A = INT (Y/100)
B = 2 - A + INT (A/4)
in the Julianischen Calendar is B = 0!

the sought JD is then:
JD = INT (365.25 * (Y + 4716))
+ INT (30.6001 * (M + 1)) + D
+ B - 1524.5

the Program to that to charge the Julianischen Datums position itself then folgendermaßen dar.
mind tappt im dunkeln, that because of the Besonderheit the Julianischen Datums the day not as Integer,
separate as Gleitpunktzahl displayed becomes.
in the Program is another second Unterprogramm include, the whom JD again in our gewohntes Datumsformat,
the Gregorianische date, umrechnet:
CompileMarkSeparation
#include <stdio.h>
#include <stdlib.h>
struct datum

{

    double tag;
    int monat;
    int jahr;

};

double julian_day(double day, int month, int year);
struct datum gregorian_date(double jday);
int main(void)

{

    int tag, monat, jahr;
    double jd;
    struct datum dat;
    printf(Tag, Monat und Jahr eingeben: );
    scanf(%d %d %d,&tag, &monat, &jahr);
    jd = julian_day(1.0*tag, monat, jahr);
    printf(
    Julianischer Tag fuer den %d.%d.%d = %1.2f
    ,
    tag, monat, jahr, jd);
    dat = gregorian_date(jd);
    printf(
    Zurueckgerechnet: %1.0f.%d.%d
    , dat.tag, dat.monat, dat.jahr);
    return 0;

}

/* Julianischer Tag (>=1):
* Gegeben: tag, monat, jahr
*
* Die gregorianische Kalenderreform wird beruecksichtigt (der Tag, der
* auf den 4. Oktober 1582 folgt ist der 15. October 1582
* Tage nach dem 15. Oktober 1582 werden als Gregorianischer Kalender
* bezeichnet. Der Julianische Tag beginnt um 12 Uhr GMT (Mittag).
* Um beliebige Uhrzeiten beruecksichtigen zu koennen, werden die Tage
* nicht als Integer- sondern als Gleitpunktzahlen angegeben.
*/
double julian_day(double day, int month, int year)

{

    int atmp, btmp, monthp, yearp;
    double ctmp;

    if (month > 2)

        {

            monthp = month + 1;
            yearp = year;

        }

    else

        {

            monthp = month + 13;
            yearp = year - 1;

        }

        if ((year > 1582) || (year == 1582 && month >= 10)

            || (year == 1582 && month ==10 && day >= 15))

            {

                atmp = year / 100;
                btmp = 2 - atmp + (atmp / 4);

            }

        else

            btmp = 0;
            atmp = 365.25 * yearp;
            ctmp = atmp;
            atmp = 30.6001 * monthp;
            ctmp =  ctmp + atmp;
            return (ctmp + day + 1720994.5 + btmp);

        }

        /* gregorian_date: Umrechnung Julianischer Tag
        in (Tag, Monat, Jahr) */
        struct datum gregorian_date(double jday)

        {

            int atmp, btmp, ctmp, dtmp, etmp, gtmp, ztmp;
            double ftmp;
            struct datum dd;
            ztmp = jday + 0.5;
            ftmp = (jday + 0.5) - ztmp;

            if (ztmp >= 2299161)

                {

                    gtmp = (ztmp - 1867216.25) / 36524.25;
                    ctmp = gtmp / 4;
                    atmp = ztmp + 1 + gtmp - ctmp;

                }

            else

                atmp = ztmp;
                btmp = atmp + 1524;
                ctmp = (btmp - 122.1) / 365.25;
                dtmp = 365.25 * ctmp;
                etmp = ((btmp - dtmp) / 30.6001);
                ztmp = 30.6001 * etmp;
                dd.tag = btmp - dtmp - ztmp + ftmp;

                if (etmp > 13.5)

                    dd.monat = etmp - 13;

                else

                    dd.monat = etmp - 1;

                    if (dd.monat > 2.5)

                        dd.jahr = ctmp - 4716;

                    else

                        dd.jahr = ctmp - 4715;
                        return(class=s4 href='./../../Function-References/XProfan/dd/'>dd);

                    }




I hope, the helps with the Umstellung. alternatively could we it indeed with the Fließkommazahl leave.

MfG
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
06/07/04  
 



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

2.756 Views

Untitledvor 0 min.
Tango07/21/17
Uwe Lang02/06/15
Michael Wodrich02/21/14
Thomas Freier08/30/13
More...

Themeninformationen

this Topic has 1 subscriber:

Michael Wodrich (2x)


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