Calculate sum of hours decimal - Javascript Date Operation

Javascript examples for Date Operation:Date Calculation

Description

Calculate sum of hours decimal

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from  ww  w . java2 s.c  o  m*/
sum = 7.9
sum = sum.toString().split(".");
console.log(sum);
sum = parseFloat(sum[0]) + parseFloat( parseInt(sum[1])>6 ? 1+(parseInt(sum[1])-6)/10 : sum[1] );
console.log(sum);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials