Solved

# Converting decimal time to standard

Posted on 2004-04-14
294 Views
how do I convert the following time which is in decimal format;

6.21207295

to

6:12:43.46

Thanks
0
Question by:lehman6676
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
1 Comment

LVL 3

Accepted Solution

monkesdb earned 50 total points
ID: 10824442
lehman6676,

i assume without working it through it's

val = 6.21207295

hours = int(val)
val = val - hours
val = val * 60
mins = int(val)
val = val - mins
val = val * 60
secs = int(val)
val = val - secs
val = val * 1000
millis = int(val)

MsgBox hours & ":" & mins & ":" & secs & "." & millis

val should equal 0 by this point
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
###### Suggested Courses
Course of the Month10 days, 5 hours left to enroll