Notifications
Clear all
Topic starter
I need a conversion script to go from grams (or kg) to separated pounds and ounces. Does someone have a quick and easy script to do this? It's a little difficult without an integer function to strip off from the decimal point onward.
Thanks,
Scott Sadler, MD
Posted : August 24, 2017 10:39 am
I just wrote this for you so double check my math but it looks correct compared to places I checked online.
fn kgToLbOz(kg){
local ozTotal, lb, oz
ozTotal = kg * 35.274
lb = truncate(ozTotal/16, 0)
oz = mod(ozTotal, 16)
return lb + "lbs " + oz + "oz"
}
Posted : August 25, 2017 2:42 am