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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Milliseconds to HH:MM:SS 1

Status
Not open for further replies.

urbanhim

MIS
Jul 11, 2007
154
0
0
GB
In our Oracle database we capture the time our website takes to complete an order (the automated process between when a client clicks "SUBMIT ORDER" to when the screen refreshes saying "ORDER COMPLETED" etc - anyway, this time is recorded in Milliseconds.

I need two new formula fields converting this to:

1. HH:MM:SS

2. MM:SS

I thought i could do this based on 1000 MS in a Second, but completely forgot about 60 seconds to a minute, so...

{SubmissionDelay}/1000

Returns "1:77" which clearly isnt any good!

Many thanks

UrbanHim
Crystal XI Report Writer
London
[shadeshappy]
[small]What's good for a hangover?... Heavy drinking the night before!![/small]
 
Please show your current formula.

-LB
 
The millisecond result * 1000 would give you seconds which can then be converted to HH:MM:SS using the formula posted by Synapsevampire in the FAQ section:

numberVar dur := ({SubmissionDelay}*1000);
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs,"00") + ":" + totext(min,"00") + ":" + totext(sec,"00");

hhmmss


Good luck

'J



CR8.5 / CRXI - Discovering the impossible
 
Hours = Milliseconds / (1000*60*60)
Minutes = (Remainder (Milliseconds,(1000*60*60) ) ) / (1000*60)
Seconds = (Remainder (Remainder (Milliseconds,(1000*60*60), ) (1000*60)) / 1000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top