Who said live is easy?Sicro wrote:There are a few other projects that I want to finish first. Before I can deal with this issue again.
But I think now and then about how best to handle the time calculations.
https://www.youtube.com/watch?v=-5wpm-gesOY
It is very complex
Extended Date [Windows, Linux, MacOS]
Re: Extended Date [Windows, Linux, MacOS]
Re: Extended Date [Windows, Linux, MacOS]
Ten years ago, I remembered a subject of a monthly book named "Sciences & Vie" (published near 1995).
The null point was Monday, January the 1st 1901.
And all consisted in adding and calculate the modulo 7. Dobro (renamed Zorro) told us the problem of a different february every 400 years, what it allowed me to make this :(source)And Fred created BOOL() function which can replace Equ() procedure and simplify this also.
The null point was Monday, January the 1st 1901.
And all consisted in adding and calculate the modulo 7. Dobro (renamed Zorro) told us the problem of a different february every 400 years, what it allowed me to make this :
Code: Select all
Global Dim Jour.S(6)
Jour(0) = "Lundi"
Jour(1) = "Mardi"
Jour(2) = "Mercredi"
Jour(3) = "Jeudi"
Jour(4) = "Vendredi"
Jour(5) = "Samedi"
Jour(6) = "Dimanche"
Procedure Equ(a, b)
Protected s.L
s = 0: If a = b: s = 1: EndIf
ProcedureReturn s
EndProcedure
; Merci Dobro pour cet algo!
Procedure.L Bissex(x.L)
Protected Result.L
Result = (1 - Equ((x % 100), 0) )
Result | Equ(((x >> 2) % 100), 0)
Result & Equ((x % 4), 0)
ProcedureReturn Result
EndProcedure
Procedure JoursDansUnMois(x.L, y.L)
Protected Result.L
Result = (30 + ((x & 1) ! (x / 8) ) )
Result - (Equ(x, 2) * (2 - y) )
ProcedureReturn Result
EndProcedure
Procedure.L JourJ(JJ.L, MM.L, AA.L)
Protected JPM.L
Protected J.L
J = 0
JPM = 0
For i = 1900 To AA - 1: J + (365 + Bissex(i) ): Next
For i = 1 To MM - 1: J + JoursDansUnMois(i, Bissex(AA) ):
Next
J = ((J + JJ) - 1) % 7
ProcedureReturn J
EndProcedure
Date$ = InputRequester("Saisie d'une date", "JJ/MM/AAAA",
"01/01/ 1900")
Debug Jour(JourJ(Val(StringField(Date$, 1, "/") ), Val
(StringField(Date$, 2, "/") ), Val(StringField(Date$, 3,
"/") ) ) ) + " " + Date$