User:Moondyne/Convert
Appearance
Abridged instructions for the {{convert}} template.
- 1st parameter is the number to convert.
- 2nd is the unit code.
- 3rd (optional) is the unit code to convert to. Most units have a logical default unit to convert to and are therefore mostly unnecessary. eg. "km" converts to "mi" unless you override it. (see example 2)
- 4th (optional) is the rounding number. ie. 0 = whole number; 1 = tenths; 2 = hundredths. (see examples 3 & 4)
Examples
[edit]{{convert|100|km}}
→ 100 kilometres (62 mi){{convert|100|km|ft}}
→ 100 kilometres (330,000 ft) -- overriding convert-to unit{{convert|100|acre|ha|2}}
→ 100 acres (40.47 ha) -- rounding to 2 decimals{{convert|100|acre|ha|0}}
→ 100 acres (40 ha) -- rounding to 0 decimals
Some common unit codes
[edit]
|
|
Optional switches
[edit]|abbr=on
→ displays 2 letter abbreviated units|lk=on
→ units are linked|sigfig={some non-negative integer}
→ display significant figures|disp=table
→ for use in tables. Result shows over 2 columns inside a table
More examples
[edit]{{convert|100|acre|ha sqmi}}
→ 100 acres (40 ha; 0.16 sq mi){{convert|33|Tcuft|km3}}
→ 33 trillion cubic feet (930 km3){{convert|100|km|abbr=on}}
→ 100 km (62 mi){{convert|100|km|abbr=on|lk=on}}
→ 100 km (62 mi){{convert|6|ft|5|in|m|2}}
→ 6 feet 5 inches (1.96 m){{convert|60|to(-)|170|kg|lb}}
→ 60 to 170 kilograms (130–370 lb)