English
Source / code snippets

date\Time To Unixtime konvertieren

 

p.specht

Unixtime
============
The Unixtime begins as Sekundenzähler with 0 on the thursday, the 1. january 1970 circa 00:00 watch UTC. Please To mind, that we UTC+1 in the winter and UTC+2 in the Sommerzeit having. The spending with the conversion becomes therefore properly the Zeitzone and period anzupassen his. The conversion becomes integrally official therefore relieved, that Schaltsekunden not mitgezählt go (These should Yes The deviation the Erdrotation a steady durchlaufenden Time correct).

the festgelegte Startdatum becomes too as Epoch marks, what with 32bit-system important go becomes, because 2038 will for Unix vaguely the repeat, what with windows already as year-2000-trouble famous watts.

In actually versions of XProfan can the everything eleganter solve. for XProfan 11.2 free was The fountain: Wikipedia "Unixtime" (Java-Beispielcode).
One explicit flotteres, in Assembler geschriebenes Unixtime-Program of M. Wodrich there here in the Board; too Dieter Zornow has with the trouble engage.

Window Title "Konverter Lesbare Zeitangabe To Unixtime (second 0 = Do,1.1.1970 00:00 UTC (then GMT)"
'Vgl:https://www.unixtimestamp.de , www.pagerenk.de/More-informationen/tools/timestampconverter.htm
Window Style 24:Declare Jahr&,Monat&,Tag&,Stunde&,Minute&,Sekunde&,utcdif&,UXTM&:luup:
CLS:print "\n UTC+1\+2h= ";:input utcdif&
Print "\n     JJJJ = ";:input Jahr&:Print "    month = ";:input Monat&
Print "      day = ";:input Tag&:Print "  hours = ";:input Stunde&
Print "  minutes = ";:input Minute&:print " sec = ";:input Sekunde&
UXTM&=Readable2Unixtime(Jahr&,Monat&,Tag&,Stunde&,Minute&,Sekunde&,utcdif&)
locate 12,12:font 2:if (UXTM&<>-1) and (UXTM&<>-2):print UXTM&
clearclip:putclip st$(UXTM&):font 2:print:print "\n ... too in Clipboard."
else:beep:print "E R R O R ";UXTM&:Endif:font 0
waitinput:waitinput:goto "luup"

Proc Readable2Unixtime' Converts gegliederte UTC-indicated to Unix-sec

    parameters Jahr&,Monat&,Tag&,Stunde&,Minute&,Sekunde&,utcdif&' GETESTET, ABER OHNE EACH GEWÄHR!
    case (jahr&<1970) or (jahr&>2038) or (monat&>12) or (monat&<1) or (tag&<1) or (tag&>31):return -1
    case (Stunde&>23) or (Minute&>59) or (Sekunde&>59) :return -2
    declare tage_seit_jahresanfang$[],istschaltjahr&,schaltjahre&,tage_seit_1970&
    'Number of days since beginning of the year without days the current month's and without Schalttag:
    tage_seit_jahresanfang$[]=explode("0,31,59,90,120,151,181,212,243,273,304,334",",")
    ' Number of Schaltjahre since 1970 without one evtl. straight current leap-year
    schaltjahre& = ((jahr&-1)-1968)/4 - ((jahr&-1)-1900)/100 + ((jahr&-1)-1600)/400
    tage_seit_1970&=(jahr&-1970)*365+schaltjahre&+val(tage_seit_jahresanfang$[monat&-1])+tag&-1

    if (jahr& mod 4)=0: istschaltjahr&=1:if (jahr& mod 100)=0: istschaltjahr&=0

        case (jahr& mod 400)=0: istschaltjahr&=1
        endif:endif' Schalttage+1, if angefragte Jahrs leap-year and deadline to february:
        case (monat&>2) and istschaltjahr&: inc tage_seit_1970&
        return int(sekunde&+60*(minute&+60*(stunde&+24*tage_seit_1970&))-utcdif&*3600)

    endproc

 
XProfan 11
Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'...
05/20/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

1.375 Views

Untitledvor 0 min.
Sven Bader05/16/24
p.specht11/21/21
R.Schneider11/20/21
Uwe Lang11/20/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