Includes | | | | - Page 1 - |
| Clemens Meier | Hello together,
I use XProfan first again since a couple Meet, circa for a friend one Geburtstagsgeschenk To basteln. thereby fell me on, that in XProfan so well How no date- and Uhrzeitfunktionen to find are. one get of course the actually Date and The actually Uhrzeit, still the was is already. nothing with to charge, vergleichen or ähnliches. and I too another begeisterter PHPler be, the items How date and mktime knows, have I time dran staid and both for XProfan as include-File realized.
I have though a couple hours used, because at testing spezieller Sonderfälle over ands over again smaller ones Problems auftauchten, The hopefully now any eliminating are.
Gültigkeitsbereich: 1970 To 2099 Sommerzeit and GMT won't berücksichtigt (would only important, if one over the computer out times vergleichen must)
indicated of month's- and Wochentagsnamen are german. Wochennummern to ISO (ächz, wasn't slight). and naturally can inside the mktime - function too calculate and the function undertaking The Korrektur the data (example see enclosed datumuhrzeit.prf). further see info.txt in the zipper-File.
I hope, it can used and be i am pleased on one Feedback
Greeting
Clemens |
| | | | |
| | | | | - Page 1 - |
| | Yes, in the german Calendar begins The first week with the week To count, The at least 4 days has. through these Verschieberei can it in a year even 53 weeks give - it must means too the Vorjahr with mind go, if The first week not 1 begins (decision: 52. od. 53. week the Vorjahres).
[quote:0bf01e8fa7=Clemens Meier]and I too another begeisterter PHPler be[/quote:0bf01e8fa7] then look you too time the Codesnippet unix time PHP on.
Approaches for Date and Zeitberechnungen find You over The Suchfunktion, it given there already some things.
Perhaps arise Yes still time one kompletter set on date-/Zeitroutinen.
Best wishes Michael Wodrich |
| | | | |
| | Jac de Lad | goes lovely, Have yet no Error discover can.
@Frank: there had I Parcival means in competition post can??? goes the now too yet, though I already so plenty there- and hergepostet Have???
Jac |
| | | Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 03/17/06 ▲ |
| |
| | Frank Abbing | clear, Jac. Know not, what against it talk ought to. |
| | | | |
| | ByteAttack | Well! i know now Real not Why it's located, but the Include depends itself on, when the 31.12.2007 in that game comes. Please time try:
$I date.inc
Declare month%,day%,year%,temp$
Window Style 26
Window Title date.inc Test
Window 0,0-%maxX,%maxY
first Test
monat%=12
tag%=31
jahr%=2008
temp$=One day later as the +st$(day%)+.+Str $(month%)+.+Str $(year%)+ is the:
print temp$+in that$(.,in that$(.,fdate(%d%m%Y,mktime(0,0,0,month%,day%+1,year%)),3),6) +1day
Zweiter Test
jahr%=2007
temp$=One day later as the +st$(day%)+.+Str $(month%)+.+Str $(year%)+ is the:
print temp$+in that$(.,in that$(.,fdate(%d%m%Y,mktime(0,0,0,month%,day%+1,year%)),3),6) +1day
waitmouse
|
| | | | |
| | GDL | Gültigkeitsbereich: 1970 To 2099
Sniff, be aba 61 born.
Hello Georg |
| | | | |
| | Dieter Zornow | by me is correct some not at Test z.B. jetziges Date and Uhrzeit to 100 hours comes by me 01.01.1970 00.00:00, the Example of Marc is too moreover.
Greeting from Bangkok
Dieter |
| | | Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2 | 10/31/07 ▲ |
| |
| | ByteAttack | Well, I faith with the MWDATE.DLL is one rather dran. (goes mere unfortunately only under Profan ex Version 10) |
| | | | |
| | Michael Wodrich | Marc-Gordon
Well, I faith with the MWDATE.DLL is one rather dran. (goes mere unfortunately only under Profan ex Version 10)
then must I there well still time dransetzen?
The Includedatei can so adjusted go, the too frühere versions so clear come (then entrapments some in the Include programmed items weg; or go rewritten).
I werds me again into ToDo-list settle...
Best wishes Michael Wodrich
P.s.: The DLL catches with 1600 on (because of leap-year-Gedöns). I personally know none More personally, the before born watts. |
| | | Programmieren, das spannendste Detektivspiel der Welt. | 10/31/07 ▲ |
| |
| | | | - Page 2 - |
| | Frank Abbing |
P.s.: The DLL catches with 1600 on (because of leap-year-Gedöns). I personally know none More personally, the before born watts.
[web]https://de.wikipedia.org/wiki/Gregorianischer_Kalender[/web] |
| | | | |
| | | Frank Abbing
Frank AbbingP.s.: The DLL catches with 1600 on (because of leap-year-Gedöns). I personally know none More personally, the before born watts. [web]https://de.wikipedia.org/wiki/Gregorianischer_Kalender[/web]
what has the a with the others To do? |
| | | | |
| | Michael Wodrich | the was one Wink with the Zaunpfahl.
the leap-year-Gedöns was a right Kalenderreform - one detective story: pope Gregor steal the whole world 10 days.
whom Link I had incidentally not yet in of my collection - must right new his. though is with Wikipedia ortelius.de not as Link aufgeführt - so missing there eindeutig something.
Best wishes Michael Wodrich |
| | | Programmieren, das spannendste Detektivspiel der Welt. | 10/31/07 ▲ |
| |
| | René Wagner | Moin,
I in my actually proposition with this INC work, had I zwangsläufig a couple smaller ones corrections distinguished. with the Monatstag-Definition were ; end, the works Perhaps with PHP, but not XProfan.
Ausserdem watts in fdate some variables twice declared. Nachfolgend the korrigierte INC-code.
PROC isdate
parameters month%,day%,year%
declare string$,checked$
string$ = @st$(day%)+.+@st$(month%)+.+@st$(year%)
if (year%>1000)
checked$ = %Y
else
checked$ = %y
endif
if (string$ = fdate(%j.%n.+checked$,mktime(0,0,0,month%,day%,year%)))
return 1
else
return 0
endif
ENDPROC
PROC now
declare string$,help$,year%,month%,day%,hour%,minute%,second%
string$ = @time$(0)+:+@substr$(@time$(1),1,.)
help$ = @substr$(string$,1,:)
hour% = help$
help$ = @substr$(string$,2,:)
minute% = help$
help$ = @substr$(string$,3,:)
second% = help$
string$ = date$(3)
help$ = @mid$(string$,1,4)
year% = help$
help$ = @mid$(string$,5,2)
month% = help$
help$ = @mid$(string$,7,2)
day% = help$
return mktime(hour%,minute%,second%,month%,day%,year%)
ENDPROC
PROC fdatelong
parameters number%
declare number$
number$ = number%
if (number%<10)
number$ = 0+@st$(number%)
endif
return number$
ENDPROC
PROC mktime
parameters stunde_mk%,minute_mk%,sekunde_mk%,monat_mk%,tag_mk%,jahr_mk%
declare sekunden&,anzahltage&,monatstage$,monatstageS$,hilfe_mk%,Help$,ende_mk%,okay_mk%,leap-year$,monatb_mk%
; on the Zeilenende removes
monatstage$ = 31,28,31,30,31,30,31,31,30,31,30,31
monatstageS$ = 31,29,31,30,31,30,31,31,30,31,30,31
Korrigiere here ggf. the date
ende_mk% = 2
while ende_mk%
okay_mk% = 1
examine The sec
if (okay_mk% = 1)
if (sekunde_mk%>59)
sekunde_mk% = sekunde_mk%-60
minute_mk% = minute_mk% + 1
okay_mk% = 0
elseif (sekunde_mk%<0)
sekunde_mk% = sekunde_mk%+60
minute_mk% = minute_mk% - 1
okay_mk% = 0
endif
endif
examine The minutes
if (okay_mk% = 1)
if (minute_mk%>59)
minute_mk% = minute_mk%-60
stunde_mk% = stunde_mk% + 1
okay_mk% = 0
elseif (minute_mk%<0)
minute_mk% = minute_mk%+60
stunde_mk% = stunde_mk% - 1
okay_mk% = 0
endif
endif
examine The hours
if (okay_mk% = 1)
if (stunde_mk%>23)
stunde_mk% = stunde_mk%-24
tag_mk% = tag_mk% + 1
okay_mk% = 0
elseif (stunde_mk%<0)
stunde_mk% = stunde_mk%+24
tag_mk% = tag_mk% - 1
okay_mk% = 0
endif
endif
examine whom day
if (okay_mk% = 1)
leap-year$ = monatstage$
if ((jahr_mk% MOD 4) = 0)
leap-year$ = monatstageS$
endif
if (monat_mk%<1)
monatb_mk% = ((monat_mk% - 1) MOD 12) + 13
else
monatb_mk% = ((monat_mk% - 1) MOD 12) + 1
endif
if (tag_mk%>@val(@substr$(leap-year$,monatb_mk%,,)))
tag_mk% = tag_mk% - @val(@substr$(leap-year$,monatb_mk%,,))
monat_mk% = monat_mk% + 1
okay_mk% = 0
elseif (tag_mk%<1)
monat_mk% = monat_mk% - 1
if (monat_mk%<1)
monatb_mk% = ((monat_mk% - 1) MOD 12) + 13
else
monatb_mk% = ((monat_mk% - 1) MOD 12) + 1
endif
tag_mk% = tag_mk% + @val(@substr$(leap-year$,monatb_mk%,,))
okay_mk% = 0
endif
endif
examine whom month
if (okay_mk% = 1)
if (monat_mk%>12)
monat_mk% = monat_mk%-12
jahr_mk% = jahr_mk% + 1
okay_mk% = 0
elseif (monat_mk%<1)
monat_mk% = monat_mk%+12
jahr_mk% = jahr_mk% - 1
okay_mk% = 0
endif
endif
examine the year
if (okay_mk% = 1)
if (jahr_mk%<1970)
return #OUT OF RANGE#
elseif (jahr_mk%>2099)
return #OUT OF RANGE#
else
ende_mk% = 0
endif
endif
wend
Berechne ex 1970
jahr_mk% = @int(jahr_mk% - 1970)
anzahltage& = jahr_mk% * 365
The Schaltjahre moreover
if (monat_mk%>2)
anzahltage& = anzahltage& + @int((jahr_mk%+2)/4)
else
anzahltage& = anzahltage& + @int(((jahr_mk%-1)+2)/4)
endif
The month moreover
if (monat_mk%>1)
whileloop 1,(monat_mk%-1)
Help$ = @substr$(monatstage$,&loop,,)
hilfe_mk% = Help$
anzahltage& = anzahltage& + hilfe_mk%
endwhile
endif
anzahltage& = anzahltage& + tag_mk% - 1 The 1. day begins Yes with 0 sec
sekunden& = anzahltage& * 24 * 60 * 60
sekunden& = sekunden& + (stunde_mk% * 60 * 60)
sekunden& = sekunden& + (minute_mk% * 60)
sekunden& = sekunden& + sekunde_mk%
return sekunden&
ENDPROC
PROC fdate
end% only yet once deklarieren
declare gesamttage&,week-day%,end%,restsekunden&,resttage%,tagimjahr%,week%,Help%,Help2%
declare year%,month%,day%,hour%,minute%,second%,jahr_test%,anzahltage_test&,sekunden_test&
declare wochentaglistekurz$,wochentaglistelang$
declare monatekurz$,monatelang$,monatstage$,monatstageS$,leap-year$,testsekunden&
if (%PCount = 1)
Parameters datestring$
sec first here deklarieren, so double Deklaration unterbinden
declare sekunden&
sekunden& = now()
elseif (%PCount = 2)
Parameters datestring$,sekunden&
else
return
endif
Do a list of data
wochentaglistekurz$ = so,Mo,Di,wen,Do,Fr,Sa
wochentaglistelang$ = sunday,monday,tuesday,wednesday,thursday,friday,saturday
monatekurz$ = jan,Feb,Mär,Apr,May,Jun,Jul,Aug,Sep,Okt,Nov,Dez
monatelang$ = january,february,March,april,May,june,july,august,september,october,november,december
; on the Zeilenende removes
monatstage$ = 31,28,31,30,31,30,31,31,30,31,30,31
monatstageS$ = 31,29,31,30,31,30,31,31,30,31,30,31
as erstes once need I The amount the days, for whom week-day
The 1.1.1970 was week-day 4 = thursday
gesamttage& = @int(sekunden& / 86400)
week-day% = @int(gesamttage& MOD 7)
week-day circa 4 correct, because if week-day% = 0 = sunday is , is it really thursday
week-day% = week-day% + 4
if (week-day%>6)
week-day% = week-day% - 7
endif
If one The days has, can one slight on the year come
resttage% = gesamttage&
year% = @int(((4*resttage%)/1461) + 1970)
caution, the year could wrong his
examine the, because You a day before The mktime anfragst
jahr_test% = year%
jahr_test% = @int(jahr_test% - 1970)
anzahltage_test& = jahr_test% * 365
The Schaltjahre moreover
anzahltage_test& = anzahltage_test& + @int(((jahr_test%-1)+2)/4)
sekunden_test& = anzahltage_test& * 24 * 60 * 60
if (sekunden_test&>sekunden&)
Ups, the year is wrong
year% = year% - 1
endif
jahr_test% = year%
jahr_test% = @int(jahr_test% - 1970)
anzahltage_test& = jahr_test% * 365
The Schaltjahre moreover
anzahltage_test& = anzahltage_test& + @int(((jahr_test%-1)+2)/4)
sekunden_test& = anzahltage_test& * 24 * 60 * 60
$testsekunden& must small his, as sekunden&
I need now The Restsekunden for The months
restsekunden& = sekunden& - sekunden_test&
resttage% = @int(restsekunden& / (24*60*60))
tagimjahr% = resttage% the year begins Yes with the 1. day, not with the 0. day
In welchem month lying this day
end% = 1
month% = 1
leap-year$ = monatstage$
if (year% MOD 4 = 0)
leap-year$ = monatstageS$
endif
while end%
if ((resttage%+1)>@val(@substr$(leap-year$,month%,,)))
resttage% = resttage% - @val(@substr$(leap-year$,month%,,))
month% = month% + 1
else
end% = 0
endif
wend
day% = resttage% + 1 too here again, month begins with day 1 and not day 0
restsekunden& = sekunden& - mktime(0,0,0,month%,day%,year%)
hour% = @int(restsekunden& / (60*60))
restsekunden& = restsekunden& MOD (60*60)
minute% = @int(restsekunden& / 60)
restsekunden& = restsekunden& MOD 60
second% = restsekunden&
Berechne The week
Help% = week-day%
if (Help%=0)
Help% = 7
endif
week% = @int((tagimjahr% - Help% + 7) / 7)
If week-day% on the 1.1.the year < 5 is, then must korrigiert go
Help2% = 7 - ((tagimjahr% - Help% + 7) MOD 7)
if (Help2%=0)
Help2%=7
endif
if (Help2%<5)
week% = week% + 1
elseif (week% = 0)
week% = fdate(%W,mktime(0,0,0,12,24,year%-1)) + 1
endif
and now whom String supplant
datestring$ = @translate $(datestring$,%Y,@st$(year%))
datestring$ = @translate $(datestring$,%y,fdatelong(@val(@Right$(@st$(year%),2))))
datestring$ = @translate $(datestring$,%d,fdatelong(day%))
datestring$ = @translate $(datestring$,%j,@st$(day%))
datestring$ = @translate $(datestring$,%D,@substr$(wochentaglistekurz$,(week-day%+1),,))
datestring$ = @translate $(datestring$,%l,@substr$(wochentaglistelang$,(week-day%+1),,))
datestring$ = @translate $(datestring$,%F,@substr$(monatelang$,month%,,))
datestring$ = @translate $(datestring$,%G,@st$(hour%))
datestring$ = @translate $(datestring$,%H,fdatelong(hour%))
datestring$ = @translate $(datestring$,%i,fdatelong(minute%))
datestring$ = @translate $(datestring$,%m,fdatelong(month%))
datestring$ = @translate $(datestring$,%n,@st$(month%))
datestring$ = @translate $(datestring$,%M,@substr$(monatekurz$,month%,,))
datestring$ = @translate $(datestring$,%s,fdatelong(second%))
datestring$ = @translate $(datestring$,%t,@substr$(leap-year$,month%,,))
datestring$ = @translate $(datestring$,%w,@st$(week-day%))
datestring$ = @translate $(datestring$,%W,@st$(week%))
datestring$ = @translate $(datestring$,%z,@st$(tagimjahr%))
return datestring$
ENDPROC
Greeting René |
| | | Mit XProfan erstellte Freeware findet ihr hier: [...] US World Domination Tour - bombing a country near you... | 08/11/08 ▲ |
| |
|
AnswerTopic-Options | 19.206 Views |
Themeninformationenthis Topic has 10 subscriber: |