Function Dates Times Class

HMSToDecimal

"Hours Minutes Seconds To Decimal Degrees" Convert number representing Hours, Minutes, and Seconds into a decimal number of hours. Converts 12.345678 (representing 12h 34m 56.78s) to 12.5824388

Signature (Visual Basic / VBA)

Public Function HMSToDecimal( _
    ByVal vHMS As Variant _
    ) As Variant

Code Example

    HMSToDecimal(4.33198) =  4.5555
    HMSToDecimal( 4.4536) =  4.76
    HMSToDecimal(-4.4536) = -4.76

Parameters

Parameter Description
vHMS A number which represents hours, minutes, and seconds in "HMS" format. Function returns Null if vHMS is Null or cannot be fixed up to a number. In an HMS format number, the integer part represents hours, the first two floating point digits represent minutes, the next two digits represent seconds, and the remaining digits represent a fractional number of seconds.