Template:Convert/doc
This template is used in articles to easily convert one unit to another. This template will always be under construction, as we can’t possibly include conversions ‘’from’’ every possible unit ‘’to’’ every possible unit. However, whenever a conversion isn’t supported, I or any of the other users who have worked on this template would be happy to add conversions when brought to our attention. The goal of this template is to make the Citizendium accessible to all readers regardless of nationality. Instead of only showing SI/Metric units or Imperial units, {{convert}} automatically converts a number from the specified unit to another unit and displays it as "Metric (Imperial)" or "Imperial (Metric)", depending on which unit was converted from.
Usage
The template has four parameters - {{convert|number|from|to|precision}}
.
- required — The number to convert.
- required — The unit to convert from.
- required — The unit to convert to.
- optional — The precision of the result. Positive values cause the specified number of decimal places to be shown, whilst negative values cause the numbers to be rounded to the specified number of significant figures. The default value is 2 (2 decimal places).
The names of the units can be specified as either abbreviations or full words, using either British or American spelling. The unit names in the output will be in the same format as the input.
Supported Conversions
Transcluded from Template:Convert/doc/conversions ( )
Length Conversions
Metric to Imperial
→ | Inches (in) | Feet (ft) | Yards (yd) | Miles (mi) | Nautical Miles (nmi) |
---|---|---|---|---|---|
Millimetres (mm) | Yes | Yes | No | No | No |
Centimetres (cm) | Yes | Yes | No | No | No |
Decimetres (dm) | Yes | Yes | No | No | No |
Metres (m) | Yes | Yes | Yes | Yes | Yes |
Kilometres (km) | No | No | Yes | Yes | Yes |
Imperial to Metric
→ | Millimetres (mm) | Centimetres (cm) | Decimetres (dm) | Metres (m) | Kilometres (km) |
---|---|---|---|---|---|
Inches (in) | Yes | Yes | Yes | Yes | No |
Feet (ft) | Yes | Yes | Yes | Yes | Yes |
Yards (yd) | Yes | Yes | Yes | Yes | Yes |
Miles (mi) | No | No | No | Yes | Yes |
Nautical Miles (nmi) | No | No | No | Yes | Yes |
Imperial to Imperial
→ | Miles (mi) | Nautical Miles (nmi) |
---|---|---|
Miles (mi) | - | Yes |
Nautical Miles (nmi) | Yes | - |
Weight Conversions
→ | Kilogrammes (kg) | Grammes (g) | Pounds (lbs) | Ounces (oz) |
---|---|---|---|---|
Kilogrammes (kg) | - | No | Yes | Yes |
Grammes (g) | No | - | Yes | Yes |
Pounds (lbs) | Yes | Yes | - | No |
Ounces (oz) | Yes | Yes | No | - |
Temperature Conversions
→ | Celsius (°C) | Kelvin (°K) | Fahrenheit (°F) | Rankine (°R) |
---|---|---|---|---|
Celsius (°C) | - | Yes | Yes | Yes |
Kelvin (°K) | Yes | - | Yes | No |
Fahrenheit (°F) | Yes | Yes | - | Yes |
Rankine (°R) | Yes | No | Yes | - |
Rounding
{{Convert}} has an additional parameter that controls roundin. More specifically, it controls how many places after the decimal are displayed. To use this feature, add a value in the fourth parameter. For example {{Convert|10|km|mi|5}} shows up to the fifth decimal place, displaying as 10 km (6.21371 mi).
Examples
{{Convert|547.3|km|mi|0}} hides the decimals, displaying as 547.3 km (340 mi).
{{Convert|547.3|km|mi|1}} shows one decimal, displaying as 547.3 km (340.1 mi)
{{Convert|547.3|km|mi|2}} shows two decimals, displaying as 547.3 km (340.08 mi)
{{Convert|547.3|km|mi|3}} shows three decimals, displaying as 547.3 km (340.076 mi)
{{Convert|547.3|km|mi|10}} shows ten decimals, displaying as 547.3 km (340.0764533816 mi)
Parameters That Need to be Created
Add units of measurement, and their conversion formulas, that still need to be created here