Module baseric
Function alltrim(ByVal monparam)
Return (LTrim(RTrim(monparam)))
End Function
Function alen(ByVal montableau)
Return montableau.length
End Function
Function padl(ByVal chaine, ByVal clong, ByVal remplac)
Return chaine.padleft(clong, remplac)
End Function
Function padr(ByVal chaine, ByVal clong, ByVal remplac)
Return chaine.padright(clong, remplac)
End Function
Function strtran(ByVal chaine, ByVal aremplacer, ByVal parlachaine)
Replace(chaine, aremplacer, parlachaine)
Return chaine
End Function
Function substr(ByVal chaine, ByVal caracdeb, ByVal nbcarac)
If (caracdeb - 1) + nbcarac > chaine.length Then
nbcarac = chaine.length - caracdeb
End If
Return chaine.substring(caracdeb - 1, nbcarac)
End Function
Function at(ByVal chainecherchée, ByVal chaine)
Return InStr(chaine, chainecherchée)
End Function
Function time()
Return Format(Now(), "hh:mm:ss")
End Function
Function aujourdhui()
Return Date.Today
End Function
Function dift(ByVal t1, ByVal t2)
Dim theu As String, tmin1 As String, ts As String, th2 As String, tmin2 As String, tsec2 As Integer, r As Integer, rh1 As Integer, rs1 As Integer, rh As Integer, rm As Integer, rs As Integer, retour As String
Dim heu As Integer, min1 As Integer, s As Integer, h2 As Integer, min2 As Integer, sec2 As Integer
rh = 0
rm = 0
rs = 0
theu = substr(t1, 1, (at(":", t1) - 1))
tmin1 = substr(t1, 4, 2)
ts = substr(t1, 7, 2)
heu = Val(theu)
min1 = Val(tmin1)
s = Val(ts)
heu = heu * 60
min1 = min1 * 60
s = s + min1 + (heu * 60)
th2 = substr(t2, 1, (at(":", t2) - 1))
tmin2 = substr(t2, 4, 2)
tsec2 = substr(t2, 7, 2)
h2 = Val(th2)
min2 = Val(tmin2)
sec2 = Val(tsec2)
h2 = h2 * 60
min2 = min2 * 60
sec2 = sec2 + min2 + (h2 * 60)
If sec2 > s Then
r = sec2 - s
Else
r = s - sec2
End If
retour = nvertem(r)
Return retour
End Function
Function temvern(ByVal temp1)
temp1 = alltrim(temp1)
Dim s As String, m As String, h As String, retour As String
s = substr(temp1, Len(temp1) - 1, 2)
s = Val(s)
m = substr(temp1, Len(temp1) - 4, 2)
m = Val(m) * 60
h = substr(temp1, 1, Len(temp1) - 6)
h = Val(h) * 3600
retour = h + m + s
Return retour
End Function
Function modulo(ByVal adiviser, ByVal diviserpar)
Return adiviser Mod diviserpar
End Function
Function nvertem(ByVal temp1)
Dim s As Integer, m As Integer, h As Integer, resth As Double, restm As Double
h = Int(temp1 / 3600)
resth = modulo(temp1, 3600)
m = Int((resth) / 60)
restm = modulo(m, 60)
s = Int(modulo(resth, 60))
Return padl(h.ToString, 5, "0") + ":" + padl(m.ToString, 2, "0") + ":" + padl(s.ToString, 2, "0")
End Function
End Module
|
Bonjour Olivier,
Je viens de faire la modif.
A bientôt
Eric