-
I am sure this is easy to do, but what's the easiest way to convert a date into it's decimal equivalent.
i.e. 6:45 = 6.75 etc....
I know I could just frig it using math formulas but is there a built in VB function as I can't seem to find one.
Thanks For any help
Steve
-
Have a go with this formula...
Code:
Public Function TimeToDec(Dat As Date) As Single
TimeToDec = Hour(Dat) + ((1 / 60) * Minute(Dat)) + ((1 / 6000) * Second(Dat))
End Function
I'm not sure abaut the seconds-part then...
Try this for minute-precsion:
Code:
Public Function TimeToDec(Dat As Date) As Single
TimeToDec = Hour(Dat) + ((1 / 60) * Minute(Dat))
End Function
Enjoy!
-
Cheers