Convert Serial number to Time

  • Thread starter Thread starter mudraker
  • Start date Start date
M

mudraker

Can someone pleae show me how to convert a decimal number to time in
VBA

0.249999999966667 = 6:00:00

Thanks In advance
 
Dave

Thanks for your reply but that is not what i am after.

I have a serial number that I need to convert to time in a vba macro
anf then have the macro process more code
 
Can someone pleae show me how to convert a decimal number to time in
VBA

0.249999999966667 = 6:00:00

Thanks In advance


---

That value is already equivalent to 6AM because of how Excel stores and
displays dates and times.

If you do something like:

Const dectime As Date = 0.249999999966667
MsgBox ("The time is: " & dectime)

The box will display: The time is 6:00:00 AM.

Since that's not quite what you specified, you'd need to format it more
precisely:

MsgBox ("The time is: " & Format(dectime, "h:mm:ss"))

In the latter case, dectime can be either a Date or a Double number type.


--ron
 
Back
Top