MyTetra Share
Делитесь знаниями!
Вычисление времени
Время создания: 31.07.2019 23:32
Текстовые метки: Вычисление времени
Раздел: Разные закладки - VBA - Операции с датами-временем
Запись: xintrea/mytetra_db_adgaver_new/master/base/1536649041cj3eodi12h/text.html на raw.githubusercontent.com

'===========================================================================================

' ##### Вычисление времени

'

'Sub test_FnStBarTimer()

' t = Timer

' For i = 1 To 100

' Статус_бар = FnTimer(Timer - t)

' Stop

' Next i

' Статус_бар = FnStBar("")

'End Sub

'------------------------------------------------------------------------------------------------

Function FnTimer_Str(ByVal sinTimer As Single) As String

Const lngHour_1 As Integer = 3600

Const lngMin_1 As Integer = 60

Dim lngHour As Long, strHour As String

Dim lngMin As Long, strMin As String

Dim lngSec As Long, strSec As String

Dim lngDeltaSec As Long

Dim strBarTimer As String


lngHour = Fix(sinTimer / lngHour_1): strHour = lngHour

lngMin = Fix((sinTimer - lngHour_1 * lngHour) / lngMin_1): strMin = lngMin

lngSec = (sinTimer - (lngHour_1 * lngHour) - (lngMin_1 * lngMin)): strSec = lngSec

'If lngSec < 0 Then lngSec = lngSec * -1


If Len(strHour) = 1 Then strHour = "0" & strHour

If Len(strMin) = 1 Then strMin = "0" & strMin

If Len(strSec) = 1 Then strSec = "0" & strSec


FnTimer_Str = strHour & ":" & strMin & ":" & strSec


' Application.StatusBar = FnTimer_Str

' DoEvents

End Function

'===========================================================================================

 
MyTetra Share v.0.65
Яндекс индекс цитирования