# How to find a rate

How can I find a numerical value this equation to be multiplied by another number (\$41.56/hour)

In the equation below I return a time. I then want to take that time and multiply it by (41.56) and get my result to again multiple by a number

How can I do this?

``````Shared NumberVar scrapped_Time;
numberVar dur := scrapped_Time;
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,"0") + ":" + totext(min,"00") + ":"+ totext(sec,"00");
``````
###### Who is Participating?

Commented:
Name - YourFormula
Shared NumberVar scrapped_Time;
numberVar dur := scrapped_Time;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;
numbervar amount;

amount := dur / 3600 * 41.56;
hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

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

Add another formula to display the value calculated
EvaluateAFter({@YourFormula});
numbervar amount;
amount

mlmcc
0

Senior Oracle DBACommented:
The rate should be:

(hrs*41.56) + ((min/60)*41.56) + ((sec/3600)*4156)

0

Senior Oracle DBACommented:
Sorry, missed a decimal place:

(hrs*41.56) + ((min/60)*41.56) + ((sec/3600)*41.56)
0

Commented:
Or just

(dur/3660) * 41.56

mlmcc
0

Sr. System AnalystCommented:
"I return a time" --> I guess you are returning a text like "2:34:56"

create a function to convert this to number

first split it by ":", then convert each piece to numeric, convert each piece to hour

numberVar v = (int)split("2:34:56",":")[0] + (int)split("2:34:56",":")[1]/60 + (int)split("2:34:56",":")[2]/(60*60)

and use this function to convert your time (actually string) into numerical values...

float Convert2Num(t) {
the logic above, and return numeric value
}

Convert2Num("2:34:56") = 2.5822
0

Commented:
Or, since you've already got the time in scrapped_Time, you could just use that.  Create a formula like this and put it in the same section as the formula that you posted.

Shared NumberVar scrapped_Time;
scrapped_Time / 3600 * 41.56

If you also want to use that value for something else, you'll need another formula and/or variable.  It depends on what you want to do with it.

James
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.