|
|
Дата - Преобразование часов, минут и секунд в суммарное кол-во секунд и обратно
Работает примерно так:
Private Function esSecondsToTime(lngSec As Long, WhatReturn As Byte) As Long
Dim h As Long, m As Long, s As Long, x As Long
On Error GoTo SecondsToTimeErr
x = lngSec
h = x \ 3600
x = x - (h * 3600)
m = x \ 60
x = x - m * 60
s = x
Select Case WhatReturn
Case 1: esSecondsToTime = h
Case 2: esSecondsToTime = m
Case 3: esSecondsToTime = s
Case Else: esSecondsToTime = 0
End Select
Exit Function
SecondsToTimeErr:
esSecondsToTime = 0
End Function
Private Function esTimeToSeconds(lngH As Long, lngM As Long, lngS As Long) As Long
On Error GoTo TimeToSecondsErr
esTimeToSeconds = lngH * 3600
esTimeToSeconds = esTimeToSeconds + lngM * 60
esTimeToSeconds = esTimeToSeconds + lngS
Exit Function
TimeToSecondsErr:
esTimeToSeconds = 0
End Function
|
|