CONVERTTIME

Returns the time converted to a decimal hours, minutes or seconds.


Remarks

* For instructions on how to add a function to a workbook refer to the page under Inserting Functions
* The equivalent JavaScript function is CONVERTTIME
'1:00:00 = 1
'01:15:00 = 1.25
'17:30:00 = 17.5
'16:00:00 = 16
'23:45:00 = 23.75



CONVERTTIME_HOURS

'simply multiply it by 24 'each hour can be represented as 1/24

Public Function CONVERTTIME_HOURS( _ 
         ByVal sngTime As Single) As Double
   
   CONVERTTIME_HOURS = (24 * sngTime)

End Function

CONVERTTIME_MINUTES


Public Function CONVERTTIME_MINUTES( _ 
         ByVal sngTime As Single) As Double

   CONVERTTIME_MINUTES = (24 * sngTime) * 60

End Function

CONVERTTIME_SECONDS


Public Function CONVERTTIME_SECONDS( _ 
         ByVal sngTime As Single) As Double

   CONVERTTIME_SECONDS = ((24 * sngTime) * 60) * 60

End Function


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext