Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Km per hour -> how many hours 1

Status
Not open for further replies.

flaviooooo

Programmer
Feb 24, 2003
496
FR
Hey,

if I have a value number of kilometers, and a value kilometers/hour... how can I calculate and display the number of hours, minutes and seconds (even thousands of seconds if possible)?

So I have 50 kilometers, we have a speed of 20 km/hour ->
2,5 = 2:30:00:)00)

Thanks in advance
 





Hi,

Convert hours to days and use the Format function to return hh:mm:ss

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
So easy :)

Have a star on me...

Btw: is there a "code" for a step further then seconds (what is it, milliseconds?) ?

 





You would have to handle the conversion in code, starting with whole hours and taking the remainder and converting hours to minutes, taking whole minutes and taking the remainder and converting from minutes to seconds....

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
what is the precision of the kilometers/hour values ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Number of kilometers is an integer, so for example 53
 
Really ?
So, I wonder why the milliseconds are so important ...
 
To really look at the root of the issue, you should search these foa (and FAQs) for time base calculations. You would eventually find that date/time is simply a floating point number. In the schema, the whole number part is the number of days since Dec. 30, 1898 and decimal part of the value is the "percent" of the day left over. There are 86400 seconds in a day. The remainder is simple math, with the caveat that the various date-time intrinsic function cannot (will not?) return values smaller that one second, so to see any further resoloution you need to create custom procedures.



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top