Skip to content

Instantly share code, notes, and snippets.

@basti
Created July 31, 2010 12:34
Show Gist options
  • Save basti/502133 to your computer and use it in GitHub Desktop.
Save basti/502133 to your computer and use it in GitHub Desktop.
Convert height/length from cm to feet and inches
def self.cm_to_feet_and_inches(cm)
feet = (cm / 30.48).floor
inches_total = cm / 2.54
inches = (inches_total - (feet * 12)).round
"#{feet} #{inches}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment