how do I split a decimal number?

I have input boxes with the total hours for one given project and total hours worked for that day. I took the hours and minutes and split them up. I am trying to take the minutes and divide them by 60 to get the hour on the left side of the decimal and the minutes on the other side of the decimal that I plan to multiply by .06 to get the total minutes, but I cannot seem to get past the point of getting the decimal.

the code I need to get working is

var newMin = totMins2.split(".");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language=javascript>
          function calculate(){
			   //var new3 = total2.Length;
			   //var newh = parseInt(new2.substring(0,2));
			   //var newm2 = parseInt(total2[1].substring(0,5));
			   var strNum = document.getElementById("timeTot").value;
			   var findColon = strNum.indexOf(':');
			   if (findColon<=1)
			   strNum = "0" + strNum;
			   var getMin = strNum.substring(findColon + 2, 5);
			   var getMin = strNum.substring(findColon + 1, 5);
			   var getHour = strNum.substring(0, 2);
			   var strNum2 = document.getElementById("dailyTot").value;
			   var findColon2 = strNum2.indexOf(':');
			   if (findColon2<=1)
			   strNum2 = "0" + strNum2;
			   var getMin2 = strNum2.substring(findColon2 + 2, 5);
			   var getMin2 = strNum2.substring(findColon2 + 1, 5);
			   var getHour2 = strNum2.substring(0, 2);
			   var totHours = parseInt(getHour*1) + parseInt(getHour2*1)
			   var totMins = parseInt(getMin*1) + parseInt(getMin2*1);
			   if (totMins <=59)
			   totMins = totMins;
			   totMins = parseFloat(totMins*1);
			   var totMins2 = totMins / 60;
			   var newMin = totMins2.split(".");
			   //var newHour = totMins[0].substring(0, 1)
			   //var newMin2 =  totMins[1].substring(0, 5)
<body onload="calculate();">
<form id="form2" name="form2" action="test.html" method="POST">
<input type='text' name="timeTot" id="timeTot" value="2:45" onBlur="if(timeTot.value!='' && dailyTot.value!='')calculate();">
<input type='text' name="dailyTot" id="dailyTot" value="5:45" onBlur="if(timeTot.value!='' && dailyTot.value!='')calculate();">

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


var newMin = totMins2.split(".");

You should be able to do...

alert(newMin[0]); //before the dot
alert(newMin[1]); //after the dot

Then you can multiply by .06 etc etc

bschave2Author Commented:
I am getting a object doesn't support the property or method error. on the var newMin = totMins2.split("."); code
you need to change the decimal number to a string to run the split method...

var tempTime = totMins2 + "";
var newMin = tempTime.split(".");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
split is a string method. Try:
var newMin = String(totMins2).split(".");
bschave2Author Commented:
thanks very much....I am learning javascript as I go.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.