Powered By Blogger
Showing posts with label cm. Show all posts
Showing posts with label cm. Show all posts

Thursday, November 9, 2017

convert feet and inch to cm in javascript OR jquery

 var minheight = toInches(ui.values[0]);
           minheight = minheight.split("'");
           //convert feet to cm
           var feetcm = minheight[0]/0.032808;
           var inchcm = minheight[1].substr(0, minheight[1].length - 1);
           //convert inch to cm
           var inchcm = inchcm/0.39370;
           var minheightcm = (parseFloat(feetcm)+parseFloat(inchcm)).toFixed(2);
            

convert feet and inch to cm in php

//$new_values[23]['value'] = 4'8";

$hegt = explode('\'', $new_values[23]['value']);
              $feet = $hegt[0];
              $inches = rtrim($hegt[1],"\"");
              $inches = ($feet * 12) + $inches;
              $cm = (int) round($inches / 0.393701);