TimeValue Function

Calculates a serial time value from the specified hour, minute, and second - parameters passed as strings - that represents the time in a single numeric value. This value can be used to calculate the difference between times.

කාරක රීතිය:

TimeValue (පෙළ String ලෙස)

ආපසු ලබාදෙන අගය:

දිනය

පරාමිතීන්:

පෙළ: ඔබට "HH:MM:SS" හැඩතලයෙන් ගණනය කිරීමට අවශ්‍ය කාලය අඩංගු ඕනෑම අනු ලකුණු වැල් ප්‍රකාශනයක්.

ඔබට කාල වෙනස ගණනය කල හැකි වන පරිදි ඕනෑම කාලයක් තනි අගයකට පරිවර්තනය කිරීමට TimeValue ක්‍රියාව භාවිතා කරන්න.

This TimeValue function returns the type Variant with VarType 7 (Date), and stores this value internally as a double-precision number between 0 and 0.9999999999.

As opposed to the DateSerial or the DateValue function, where serial date values result in days relative to a fixed date, you can calculate with the values that are returned by the TimeValue function, but you cannot evaluate them.

In the TimeSerial function, you can pass individual parameters (hour, minute, second) as separate numeric expressions. For the TimeValue function, however, you can pass a string as a parameter containing the time.

Error codes:

5 Invalid procedure call

13 Data type mismatch

උදාහරණය:

Sub ExampleTimerValue

Dim daDT As Date

Dim a1, b1, c1, a2, b2, c2 As String

    a1 = "ආරම්භක කාලය"

    b1 = "අවසාන කාලය"

    c1 = "මුළු කාලය"

    a2 = "8:34"

    b2 = "18:12"

    daDT = TimeValue(b2) - TimeValue(a2)

    c2 = a1 & ": " & a2 & chr(13)

    c2 = c2 & b1 & ": " & b2 & chr(13)

    c2 = c2 & c1 & ": " & trim(Str(Hour(daDT))) & ":" & trim(Str(Minute(daDT))) & ":" & trim(Str(Second(daDT)))

    MsgBox c2

End Sub