How to convert minutes to decimal
I need to convert my minutes in my HH:MM record to decimal.
For example if I have 43 hours and 15 minutes (43:15) I need to return the result 43.25 hours
and if i have 10 hours and 30 minutes I need to return 10.50 hours.
How do I do this?
How do I do this?
The simple answer: with math.
Longer answer: parse it using list functions and then do some math. Like this:
<cfset MyTime = "43:15">
<cfset hours = ListFirst(MyTime, ":") > <!--- get the hours part --->
<cfset minutes = ListLast(MyTime, ":") > <!--- get the minutes part --->
<cfset decimalMinutes = minutes / 60 > <!--- Calculate minutes as decimal of an hour --->
<cfset MyDecimalTime = hours + decimalMinutes > <!--- Put it all back together as decimal hours --->
Or, in more terse form:
<cfset MyTime = "43:15">
<cfset MyDecimalTime = ListFirst(MyTime, ":") + (ListLast(MyTime, ":") / 60) >
HTH,
-Carl V.
Similar Messages
-
How to convert string to decimal in data association function?
In a BPM Script component, how in the Data Association can I use an expression to convert an argument from String to Decimal? I have a Process argument named percentage which is a string. I need to set the value of a data object called signed to either "Y" or "N" based on the percentage being greater than 0.4. Something like this:
(percentage > 0.4) ? "Y" : "N"
The problem here is that percentage is a string, so must be converted to a decimal value before the compare will work. I cannot find a function that allows that. I need something like parseDecimal(percentage), but the Expression Builder does not offer that for a string using a Simple Expression.
If it cannot be converted, is there another way to do this?Guessing you figured this out on your own, but if you wanted to use a Script activity one way to do what you want is when you're creating your data associations drag the "Expression" icon in the middle and double click the icon in the middle you just added:
Get out of the Simple expression mode and into the XPath expression mode by clicking the dropdown in the upper left corner -> click "XPath Exp".
In the Functions dropdown on the right, click "Conversion Functions" -> click "number" and then insert it into the expression.
In the Variables list, select your string variable and insert it into the number function so that it looks something like this: number(bpmn:getDataObject('myStringVariable'))
Click OK
Click your expression icon in the middle and drag it over your decimal variable.
To have it evaluate and return a Boolean expression in your Script activity, add a Boolean process variable and add an XPath expression as described above except have the logic be this: number(bpmn:getDataObject('myStringVariable')) > .4 (the "greater than" shown above is added to the expression by clicking "Logical Functions" from the functions dropdown). Click OK and drag your expression icon over your Boolean variable.
Dan -
How to convert minutes into centiminutes
In Excell I can use (time)*24 and get the value as centiminutes is there a simular way to do et in Numbers?
"The data in cell D2 is 7h44m45s and the result is 7.245833 centiminutes
so I belive it works"
Assuming the "." is the decimal separator, that result says that a duration of more than seven hours is the same as a duration of approximately seven centiminutes.
Seven centiminutes is seven hundredths of a minute, which is less than five seconds.
Let's look at the math on 'paper':
7 hours = 420 minutes (7x60)
44 minutes = 44 minutes
45 seconds = 0.75 minutes
Total: 464.75 minutes
which is 46475 centiminutes
See Row 2.
The closest I can get to your numerical result is by using =DUR2DAYS(B2)*24, or STRIPDURATION(B2)*24 both of which give the result 7.74583333... (hours). See the yellow filled rows above.
DUR2DAYS converts a duration value to the equivalent number of days and decimal fraction of days. Multiplying that by 24, the number of hours in a day, gives the number of hours and decimal fraction of hours represented by that value.
Regards,
Barry
PS: must have been in a hurry earlier.
I notice I said "centiseconds" in my reply to Bressen above—should have been "centiminutes".
And in my reply to my own earlier message, I said the duration value was in F5, while the formula clearly required it to be in B2.
My bad!
B
EDIT
PPS:
I was able to get 7.2458333... after all. That is the correct value for the conversion of 7h 14m 45s to hours.
B
Message was edited by: Barry -
Hello,
I'm using a custom command and I would like to have my response to a fill slide
my problem is that the response is an u8 and it needs to be a number.
How do I need to do this?
Thanks in advance!joap wrote:
I'm using a custom command and I would like to have my response to a fill slide
my problem is that the response is an u8 and it needs to be a number.
How do I need to do this?
As others have said, U8 is a number (for convenience, it can be displayed in many ways, decimal, hexadecimal, binary, etc. but that does not change the underlying data value).
Any scalar numeric source (control, diagram constant) can be wired to a fill slide. Make sure the fill slide is an indicator.
Do you get a broken wire? If so, what does it tell you when open the context help (ctrl+h) and hover over the broken wire?
Please explain what you mean by "response". Where does the value come from, how often?
Easiest would be if you could show us your code. Make a typical value of your U8 the default before saving.
LabVIEW Champion . Do more with less code and in less time . -
Data conversion - How to convert char to decimal variant?
Hi expert,
In the example below, I want to convert the variable l_var1 to l_result
data l_var1(16) type c.
data l_preis(11) TYPE p DECIMALS 2.
data l_result(11) TYPE p DECIMALS 2.
l_preis = 10981.
write l_preis to l_var1.
after the write statement, l_var1 = 10,981.00. currently i want to move l_var1 to l_result. Is there anyone who knows how to do it? Thank you very much.Hi Liu,
I want to know the exact requirement. Instead of what you are trying to do , you can do the following way.
DATA l_var1(16) TYPE c.
*data l_preis(11) TYPE p DECIMALS 2.
DATA l_result(11) TYPE p DECIMALS 2.
l_var1 = 10981.
MOVE l_var1 TO l_result.
WRITE l_result.
<li> MOVE statement gives desired result. It gives rounding values.
Thanks
Venkat.O -
Convert hex to Decimal and keep leading zeros..
Hi,
I hope you can help?
How to convert hex to Decimal and keep leading zeros
I read 002C, hex, and I want to convert it to 0044 decimal.
sscanf (MyNum, "%4x", &DecNum); will only give me 44.
It have been working up till I started to get leading zeros.
We will always have a 4 digit hex input in a range
We must have the leading 00 in this case.
How is this best done?
Thanks for the help
Simon
Solved!
Go to Solution.Hi,
I don't really understand your problem. Is this stuff what you need ?
int main (int argc, char *argv[])
const char MyNum[] = "002C";
int DecNum;
sscanf (MyNum, "%4x", &DecNum);
printf ("%04d", DecNum);
getchar ();
return 0;
"0044" appears on standard output when printf function executes... -
How to convert decimal numbers to Hours and minutes
Hi,
I am using SSRS 2005. I want to convert decimal numbers to Hours and minutes.
Say suppose, I am adding daily work hours and minutes and the total is 208.63.
Here 208 hrs and 63 minutes. How to convert this to 209 hrs 03 minutes in SSRS.
Any In-built function is there? or how to do using custom code?
Appreciate your help.
Regards,
Balasuppose if field name is TotalDailyHours you can do it as below
=CStr(Cint(Floor(val(Fields!TotalDailyHours.Value)) + ((val(Fields!TotalDailyHours.Value)-Floor(val(Fields!TotalDailyHours.Value)))*100)/60)) + ":" +
Right("00" +Cstr(Cint(((val(Fields!TotalDailyHours.Value)-Floor(val(Fields!TotalDailyHours.Value)))*100) Mod 60)),2)
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How do I convert time from hours and minutes to decimal time
I am making a spread sheet a work for payroll. I need to make a formula that converts the time from hours and minutes to decimal time. Please help
Hi Taryn,
I can't see much from the photo, but I assume your formula is similar to the one I've used below:
The same formula is used in F4 and F6, and both return the same result (shown in F4).
F4 was left on "automatic" cell format, and the column widened to accomodate the repeating decimal to the point where Numbers would begin displaying zeros.
F6 was formatted as shown in the Cell Inspector to show only two decimal places.
Neither of these is an "exact" decimal, as it is not possible to use a decimal fraction to "exactly" represent 1/6 (or 10/60).
The likely reasons for yours showing a whole number of hours is a difference between your formula and the one shown in the example here, or a difference in the number of decimal places set in the cell's format.
Regards,
Barry
PS: To take a screen shot:
Place the mouse pointer at the top left corner of the area you want to nclude in the shot.
Press shift-command-4.
Use the mouse to drag a selection rectangle contining the part of the screen you want to include.
Release the mouse button. (You'll hear the sound of a camera shutter 'snapping' the picture.)
The screen shot will be saved to your desktop with the name 'screen shot' followed by the date and time.
The image may be posted to the discussion using the same steps you used to post the photo above.
B. -
How to convert a number to FLOAT with 9 decimal values.
Hi all,
I need to convert a number like '10.02' to a floating point number with 9 decimal values like '10.022111221'. I think that the right function is TO_BINARY_FLOAT, but how can I obtain 9 decimal values? If I use the following syntax:
select TO_BINARY_FLOAT(num) from table
I obtain a floating point values with a variable number of decimal numbers after the ".", instead I need 9 number after ".".
Regards,
Maurizio.Hi,
the number I need to select is the result of a product, for example:
select (Num_A * Num_B) from Table;
Num_A has 2 decimal numbers, like 12.01 and Num_B could be: 12.111111111.
Now, Num_A * Num_B = 653.999999994
but I issue:
select TO_BINARY_FLOAT(54.00 * 12.111111111) from Table
I obtain:
654, a rounded value, but I need 653.999999994. -
How to convert numeric data to binary decimal in java
How to convert numeric data to binary decimal in java Pleas egive me code example
There is no numeric data. It's all binary. If you're talking about Strings, look at the Integer class.
-
Do anyone know how to convert a decimal to binary, 1 into 01
do anyone know how to convert a decimal to binary
i wants to convert 1 into 01, but the computer print out 1, it didn't print 0
also 0 it also print only 0, and 3 it print11
so decimal of 3, the computer print correct, but 0 and 1 it print wrong
how can i print 01 if my decimal is 1
int a=1;
System.out.print(Integer.toBinaryString(a));
can anyone help me solve this question
and
you can use java or jsp
if you can use jsp it would be better, if not use javait's not printing anything 'wrong'.
0 in binary is 0
1 in binary is 1
All it's doing is cutting off leading zeros since they don't change the value.
1 is the same as 01 is the same as 00000001...no difference
Similarly, when you print decimal 3 as 11, it could just as easily say 00000011 and be correct, since the zeros don't change anything. -
How to Convert frames into minutes and seconds
Hi,
does anyone know how to convert frames into time (minutes and
seconds). I need the users to view the swf with current time being
played and over time. I have 2152 frames in total and I want that
to be converted to time. Can anyone help me on this. I would really
appreciate it. It is very urgent!!!!
ThanksTime Indicator,
> does anyone know how to convert frames into time
(minutes
> and seconds).
That depends entirely on the framerate of the movie. At the
default
12fps, 12 frames would be one second; 24 frames would be two.
At 24fps, 24
frames would be one second.
> I need the users to view the swf with current time being
played
> and over time. I have 2152 frames in total and I want
that to be
> converted to time. Can anyone help me on this. I would
really
> appreciate it. It is very urgent!!!!
Judging by your four exclamation points, I'd say it's
definitely urgent!
Well, again, if you're at 12fps, 2152 frames would take 179
seconds, or 2
minutes and 59 seconds. I arrived at that number by dividing
2152 by 12.
Keep in mind, though, framerate is actually more of a
guideline than an
exact figure. Framerate determines the rate at which Flash
will *try* to
display content. On an especially slow computer, the Flash
Player may not
be able to keep up, and the same number of frames might
actually take more
time.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design." -
How to convert fractional decimal number to hex number?
Hi,
Can any one help me to convert the fractional decimal number to its equivalent hex number and vice versa ?
if u have any code please share.
thanks
neethuneethukk wrote:
Can any one help me to convert the fractional decimal number to its equivalent hex number and vice versa ?
if u have any code please share.
This question is not clear at all.
"Fractional decimal" is not a data type, but a way of formatting in readable form using numeric characters and a decimal separator.
Same to "hex number", but only for integers.
What do you mean by "convert"? Do you want to keep the value the same or retain the bit pattern of the numeric data type?
Hexadecimal is for integers. Are you talking about fixed point?
We clearly need significantly more information. What are the input and output data types? What are you actually trying to do?
Do you have an example input and corresponding output?
LabVIEW Champion . Do more with less code and in less time . -
How to convert the character value to currency/numeric
Hi,
See the sample code here
data: v_qtr_field(7).
data: w_low_limit like glt0-kslvt,
w_amount like glt0-hslvt.
w_low_limit = 02.
w_max_period = 3.
concatenate 'HSL' w_low_limit into v_qtr_field.
*comment
*I am looking for a field formation thru above code like in GLT0 table like HSL02,HSL03 *etc based on the value user entered in the selection *screen
DO w_max_period TIMES
VARYING w_amount FROM v_qtr_field NEXT v_qtr_field + 1.
t_trans_values-dmbe2 = t_trans_values-dmbe2 + w_amount.
ENDDO.
I am facing problem in the Do loop as it wont allows multiple data types. can you suggest me how to convert the v_qtr_field whose data type is character to currency?Hi,
Please check this code .
PERFORM write_currency
USING buf_anla-urwrt t_dates-waers t_txw_anla-urwrt.
* FORM WRITE_CURRENCY *
* convert currency amount to string *
* - use decimal point *
* - remove separator characters *
* --> P_AMOUNT *
* --> P_CURRENCY_UNIT *
* --> P_STRING *
FORM WRITE_CURRENCY
USING P_AMOUNT TYPE P
P_CURRENCY_UNIT LIKE TCURC-WAERS
P_STRING TYPE C.
DATA: DEC2POINT(2) TYPE C VALUE ',.'.
* convert separator to decimal point
WRITE P_AMOUNT TO P_STRING CURRENCY P_CURRENCY_UNIT
NO-GROUPING
NO-SIGN
LEFT-JUSTIFIED.
TRANSLATE P_STRING USING DEC2POINT.
* put minus sign before number
IF p_amount < 0.
SHIFT P_STRING RIGHT.
P_STRING(1) = '-'.
ENDIF.
ENDFORM.
<i>Hope This Info Helps YOU.</i>
Regards,
Lakshmi -
How to determine the second decimal of currency is equal to 0.
Hi guys,
My problem is how to determine the second decimal of currency is equal to 0.
i.e: 130.23 the second decimal is 3.
Thx in advance.
Points will be rewarded.Hi Vincent,
if you want to check the internal currency value, you can not know from the field contents what is the second decimal. Because ABAP currency fields (CURR) are connected to currency key CUKY. For USD or EUR you have two decimals, japanese yen have no decimals where as some arabian pound have three decimals. The default are 2 decimals; all excetions can be found in table TCURX.
If you WRITE the value it is converted correctly according to the connected currency.
Just multiply the value with 10 to the power of decimals, e.g. USD value * ( 10 ** 2 ). Then do a MOD: second_decimal_of_currency = ( value * ( 10 ** decimals ) mod 10.
If result is zero, then the second decimal of currency is equal to 0.
Regards,
Clemens
Maybe you are looking for
-
hi friends, In third party RETURN SALES what is the business flow??? After returning the goods to vendor, How we create creit note ?? means which reference( OR,PO,RE)??? thanks
-
I'm designing a Flex application, and for the most part, I want to allow users to drive the application with simple keystrokes. Obviously I need to content with a couple of UI issues: 1) I don't want to interfere with text field input and the likes.
-
I tried to download the latest upgrade and I got a message telling me "The application or DLL ProgramFiles/CommonFiles/Apple/Applie Application Support\ApplePushService.dll is not a valid Windows image. Please check this against your installation dis
-
Dear All, I wish to connect one Non SAP system with SAP system. Database for Sap BW is SQL 2005 service pack 1. Where as database of NON SAP system is SQL 2000. Can anyone guide. I am trying to create but not able to do. I have certain querie
-
Q10 10.2.1 update
Help! Need help with 10.2.1 update Solved! Go to Solution.