Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Help:Convert

From Wikipedia, the free encyclopedia
This help page is ahow-to guide.
It explains concepts or processes used by the Wikipedia community. It is not one ofWikipedia's policies or guidelines, and may reflect varying levels ofconsensus.

Template{{convert}} is used to convert a value from one unit of measurement to another. This page provides an overview of the options available when using the template. See the documentation atTemplate:Convert for further details.

Asking questions

[edit]

Units

[edit]

Quick start

[edit]

By default, the name of the input unit is shown, while the output is abbreviated using the unit's symbol. If wanted, names or symbols can be used, and the output precision can be specified.

  • {{convert|123.4|ft|m}} → 123.4 feet (37.6 m)
  • {{convert|123.4|ft|m|abbr=on}} → 123.4 ft (37.6 m)
  • {{convert|123.4|ft|m|abbr=off}} → 123.4 feet (37.6 metres)
  • {{convert|123.4|ft|m|abbr=off|sp=us}} → 123.4 feet (37.6 meters)
  • {{convert|123.4|ft|m|0}} → 123.4 feet (38 m)
  • {{convert|123.4|ft|m|3}} → 123.4 feet (37.612 m)

Feet and inches can be converted, optionally with fractions.

  • {{convert|12.34|m|ft}} → 12.34 metres (40.5 ft)
  • {{convert|12.34|m|ftin}} → 12.34 metres (40 ft 6 in)
  • {{convert|12.34|m|ftin|frac=4}} → 12.34 metres (40 ft5+34 in)
  • {{convert|40|ft|6|in|m}} → 40 feet 6 inches (12.34 m)
  • {{convert|5+3/4|in|mm}}5+34 inches (150 mm)
  • {{convert|5+3/4|in|mm|0}}5+34 inches (146 mm)

To avoidoverlinking, units are not normally linked, but they can be when needed.

  • {{convert|12300|m2|rood|abbr=off|lk=out}} → 12,300 square metres (12.2roods)
  • {{convert|12.2|rood|m2|abbr=off|lk=in}} → 12.2roods (12,300 square metres)
  • {{convert|12300|m2|rood|abbr=off|lk=on}} → 12,300square metres (12.2roods)

A convert can be used in an adjectival phrase, and user-specified text can be inserted (e.g. -tall, -long, -high, -wide).

  • {{convert|1500|ft|m|adj=on}} → 1,500-foot (460 m)
  • {{convert|1500|ft|m|adj=mid|-long}} → 1,500-foot-long (460 m)

If no output unit is specified, a default is used.

  • {{convert|123.4|ft}} → 123.4 feet (37.6 m)
  • {{convert|123.4|ft|abbr=on}} → 123.4 ft (37.6 m)
  • {{convert|1500|ft||adj=mid|-long}} → 1,500-foot-long (460 m)

The last example used|| to explicitly show that the output unit has been omitted. If that is not done, the result is an error, and holding the mouse over the error message shows that "-long" is misinterpreted as the output unit.

The input and output can be swapped ("flipped").

  • {{convert|12300|m2|rood|abbr=off|order=flip}} → 12.2 roods (12,300 square metres)
In a flipped conversion, an option such as|lk=out means "link the right-hand side".
  • {{convert|12300|m2|rood|abbr=off|lk=out|order=flip}} → 12.2 roods (12,300square metres)
  • {{convert|12300|m2|rood|abbr=off|lk=in|order=flip}} → 12.2roods (12,300 square metres)
  • {{convert|12300|m2|rood|abbr=off|lk=on|order=flip}} → 12.2roods (12,300square metres)

The input value can be written out in words.

  • {{convert|5|mi|km|spell=in|0}} → five miles (8 km)
  • {{convert|5|mi|km|spell=In|0}} → Five miles (8 km)

Ranges of values are supported.

  • {{convert|3|-|6|ft}} → 3–6 feet (0.91–1.83 m)
  • {{convert|3|to|6|ft|abbr=off|sp=us}} → 3 to 6 feet (0.91 to 1.83 meters)

A range can use more than two values.

  • {{convert|100|x|120|x|210|mm|in}} → 100 by 120 by 210 millimetres (3.9 in × 4.7 in × 8.3 in)
  • {{convert|100|xx|120|xx|210|mm|in}} → 100 × 120 × 210 millimetres (3.9 × 4.7 × 8.3 in)
  • {{convert|100|x|120|x|210|mm|in|abbr=on}} → 100 mm × 120 mm × 210 mm (3.9 in × 4.7 in × 8.3 in)
  • {{convert|100|by|120|by|210|mm|in}} → 100 by 120 by 210 millimetres (3.9 by 4.7 by 8.3 in)

Some input units consist of multiple components.

  • {{convert|5|ft|8|in}} → 5 feet 8 inches (1.73 m)
  • {{convert|11|st|3|lb|kg}} → 11 stone 3 pounds (71 kg)

The output can show several different units.

  • {{convert|123|nmi|km mi}} → 123 nautical miles (228 km; 142 mi)
  • {{convert|123|hPa|psi inHg|abbr=on|lk=on}} → 123 hPa (1.78 psi; 3.6 inHg)

When a unit such asshort ton contains a space, use+ to separate units.

  • {{convert|1,234|metric ton|short ton+long ton}} → 1,234 metric tons (1,360 short tons; 1,215 long tons)

Some outputs give a measurement in multiple units.

  • {{convert|123.4|m|ydftin}} → 123.4 metres (134 yd 2 ft 10 in)
  • {{convert|123.4|kg|stlb}} → 123.4 kilograms (19 st 6 lb)
Onlyoutput multiple codes such asydftin can be used:
  • {{convert|123.4|m|yd ft in}} → 123.4 metres (135.0 yd; 405 ft; 4,860 in)
  • {{convert|123.4|m|yardfootinch}} → 123.4 mError in convert: Unit name "yardfootinch" is not known

Rounding

[edit]

By default, the output value is rounded to adjust its precision to match that of the input. An input such as 1234 is interpreted as 1234 ± 0.5, while 1200 is interpreted as 1200 ± 50, and the output value is displayed accordingly, taking into account the scale factor used in the conversion.

If the default is not wanted, the precision of output values can be specified using:

  • |N (whereN is a number) displaysN digits after thedecimal mark (round output toN decimal places).
  • |-N (where-N is a negative number) replacesN digits before the decimal mark with zero (round output to nearest 10N).
  • |sigfig=N (whereN is a positive number) to specify the number ofsignificant digits (round output toN significant figures).
  • |round=5 to round the output to the nearest multiple of 5. Theround value can be 0.5, 5, 10, 25 or 50.

Examples:

  • {{convert|1234|ft|m}} → 1,234 feet (376 m)
  • {{convert|1234|ft|m|2}} → 1,234 feet (376.12 m)
  • {{convert|1234|ft|m|-1}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|round=5}} → 1,234 feet (375 m)
  • {{convert|1234|ft|m|round=10}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|round=25}} → 1,234 feet (375 m)
  • {{convert|1234|ft|m|round=50}} → 1,234 feet (400 m)
  • {{convert|1234|ft|m|sigfig=2}} → 1,234 feet (380 m)
  • {{convert|1234|ft|m|sigfig=4}} → 1,234 feet (376.1 m)
  • {{convert|1230|ft|m}} → 1,230 feet (370 m)
  • {{convert|1230|ft|m|0}} → 1,230 feet (375 m)
  • {{convert|1230|ft|m|1}} → 1,230 feet (374.9 m)
  • {{convert|5670|sqft}} → 5,670 square feet (527 m2)
  • {{convert|5670|sqft|-2}} → 5,670 square feet (500 m2)
  • {{convert|7|x|8|x|12|ft|abbr=on|round=0.5}} → 7 ft × 8 ft × 12 ft (2 m × 2.5 m × 3.5 m)

An input value such as 5000 is assumed to have one significant figure, while 5001 has four. If wanted, "5000." can be used to specify an input number that has four significant figures.

  • {{convert|5000|m}} → 5,000 metres (16,000 ft)
  • {{convert|5000.|m}} → 5,000 metres (16,404 ft)

Spell

[edit]

Use|sp=us to specify that unit names should be displayed with US spelling:

  • {{convert|6|km}} → 6 kilometres (3.7 mi)
  • {{convert|6|km|sp=us}} → 6 kilometers (3.7 mi)

Using|spell=us also works:

  • {{convert|6|km|spell=us}} → 6 kilometers (3.7 mi)

Use|spell=in to specify that the input value should be spelled in words, or|spell=In (uppercase "I") to start with an uppercase letter:

  • {{convert|5|mi|km|spell=in}} → five miles (8.0 km)
  • {{convert|5|mi|km|spell=in|abbr=off|0}} → five miles (8 kilometres)
  • {{convert|5|mi|km|spell=In|0}} → Five miles (8 km)
  • {{convert|5|mi|km|spell=In|abbr=off|0}} → Five miles (8 kilometres)
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In}} → Two and a quarter miles (4 kilometres)
  • {{convert|2+1/4|mi|km|abbr=off|0|spell=In|sp=us}} → Two and a fourth miles (4 kilometers)

The input and output can be "flipped", as shown in these examples. The resulting first number is spelled:

  • {{convert|5|mi|0|order=flip|spell=in}} → eight kilometres (5 mi)
  • {{convert|5|mi|0|order=flip|spell=In|abbr=off}} → Eight kilometres (5 miles)

Both input and output values can be spelled:

  • {{convert|5|mi|m|-2|spell=on|sp=us|abbr=off}} → five miles (eight thousand meters)
  • {{convert|5|mi|m|-2|spell=On|sp=us|abbr=off}} → Five miles (eight thousand meters)

Thousands separator

[edit]

Commas in input numbers are ignored but spaces are not accepted:1,000 is one thousand but1 000 is an error.

In the output, the default thousands separator is a comma:

  • {{convert|1234567|m|ft}} → 1,234,567 metres (4,050,417 ft)
  • {{convert|1,234,567|m|ft}} → 1,234,567 metres (4,050,417 ft)

Set|comma=off to remove separators from the result:

  • {{convert|1,234,567|m|ft|comma=off}} → 1234567 metres (4050417 ft)

Setting|comma=5 adds a separator only when the number of digits is 5 or more:

  • {{convert|1234|m|ft}} → 1,234 metres (4,049 ft)
  • {{convert|1234|m|ft|comma=5}} → 1234 metres (4049 ft)
  • {{convert|12345|m|ft|comma=5}} → 12,345 metres (40,502 ft)

Set|comma=gaps to use a small space for thousands grouping. If the resulting number is copied, only the digits are copied (the gaps are omitted).

  • {{convert|1234567|m|ft}} → 1,234,567 metres (4,050,417 ft)
  • {{convert|1234567|m|ft|comma=gaps}}1234567 metres (4050417 ft)

Gaps are inserted on both sides of the decimal mark. However, by default, no gap is inserted before a single digit. If a gap is always wanted,|comma=gaps3 can be used.

  • {{convert|1234.98765|m|ft|comma=gaps}}1234.98765 metres (4051.7968 ft)
  • {{convert|1234.98765|m|ft|comma=gaps3}}1234.98765 metres (4051.7968 ft)
  • {{convert|1234.9876|m|ft|comma=gaps}}1234.9876 metres (4051.797 ft)
  • {{convert|1234.9876|m|ft|comma=gaps3}}1234.9876 metres (4051.797 ft)
  • {{convert|1.2349876|m|ft|comma=gaps}}1.2349876 metres (4.051797 ft)
  • {{convert|1.2349876|m|ft|comma=gaps3}}1.2349876 metres (4.051797 ft)

Fractions

[edit]

An input value can be specified as a fraction.

  • {{convert|1/2|in|mm|1}}12 inch (12.7 mm)
  • {{convert|1/2|in|mm|1|adj=on}}12-inch (12.7 mm)
  • {{convert|2+1/2|in|mm|1}}2+12 inches (63.5 mm)
  • {{convert|1|ft|10+5/8|in}}1 foot10+58 inches (0.575 m)
  • {{convert|-2-1/4|in|mm|1}}−2+14 inches (−57.2 mm)
  • {{convert|1/2|in|mm|1|spell=in}} → one-half inch (12.7 mm)

If two slashes are used, a horizontal fraction bar is used.

  • {{convert|1//2|in|mm|1}}1/2 inch (12.7 mm)
  • {{convert|2+1//2|in|mm|1}}2+1/2 inches (63.5 mm)

An output can be expressed with a fraction using|frac=N whereN is the denominator. For example,|frac=8 rounds the output to the nearest eighth.

  • {{convert|219|mm|in|abbr=on}} → 219 mm (8.6 in)
  • {{convert|219|mm|in|abbr=on|frac=2}}219 mm (8+12 in)
  • {{convert|219|mm|in|abbr=on|frac=4}}219 mm (8+12 in)
  • {{convert|219|mm|in|abbr=on|frac=8}}219 mm (8+58 in)
  • {{convert|222|mm|in|abbr=on|frac=8}}222 mm (8+34 in)

A fraction is applied to the output unit (if there is only one), or to non-SI units (if using a combination), except that if a precision is also specified, the fraction only applies to thehand unit.

  • {{convert|18.45|in|m|frac=2}}18.45 inches (12 m)
  • {{convert|18.45|in|ft in hand cm|frac=2}}18.45 inches (1+12 ft;18+12 in; 4.2+12hands; 46.9 cm)
  • {{convert|18.45|in|ft in hand cm|frac=2|1}}18.45 inches (1.5 ft; 18.5 in; 4.2+12hands; 46.9 cm)

If|frac=-N is used (negativeN), a horizontal fraction bar is used for the output.

  • {{convert|12.7|mm|frac=-2}}12.7 millimetres (1/2 in)
  • {{convert|222|mm|in|abbr=on|frac=-8}}222 mm (8+3/4 in)

Joins

[edit]

The|disp= ("display") option may be used to "join" the input and output, as shown in the following examples.

ConvertOutputDescription
{{convert|2.4|m|ft}}2.4 metres (7.9 ft)default
{{convert|2.4|m|ft|disp=sqbr}}2.4 metres [7.9 ft]square brackets
{{convert|2.4|m|ft|disp=or}}2.4 metres or 7.9 feetor
{{convert|2.4|m|ft|disp=comma}}2.4 metres, 7.9 ftcomma
{{convert|2.4|m|ft|disp=semicolon}}2.4 metres; 7.9 ftsemicolon
{{convert|2.4|m|ft|disp=br}}2.4 metres
7.9 feet
"<br />", line break
{{convert|2.4|m|ft|disp=br()}}2.4 metres
(7.9 feet)
line break and brackets

Ranges

[edit]

A range of values can be specified, as shown in the following examples.

SeparatorConvertResultNotes
-{{convert|3|-|6|ft}}3–6 feet (0.91–1.83 m)Input can be hyphen (-) oren dash (–), output uses en dash
and{{convert|3|and|6|ft}}3 and 6 feet (0.91 and 1.83 m)
and(-){{convert|3|and(-)|6|ft}}3 and 6 feet (0.91–1.83 m)and on left; en dash on right
and(-)|order=flip{{convert|3|and(-)|6|ft|order=flip}}0.91 and 1.83 metres (3–6 ft)
or{{convert|3|or|6|ft}}3 or 6 feet (0.91 or 1.83 m)
to{{convert|3|to|6|ft}}3 to 6 feet (0.91 to 1.83 m)
to(-){{convert|3|to(-)|6|ft}}3 to 6 feet (0.91–1.83 m)to on left; en dash on right
to(-)|order=flip{{convert|3|to(-)|6|ft|order=flip}}0.91 to 1.83 metres (3–6 ft)
to about{{convert|3|to about|6|ft}}3 to about 6 feet (0.91 to about 1.83 m)
+/-{{convert|3|+/-|6|ft}}3 ± 6 feet (0.91 ± 1.83 m)
± &plusmn;{{convert|3|±|6|ft}}3 ± 6 feet (0.91 ± 1.83 m)
+{{convert|3|+|6|ft}}3 + 6 feet (0.91 + 1.83 m)
,{{convert|3|,|6|ft}}3, 6 feet (0.91, 1.83 m)
, and{{convert|3|, and|6|ft}}3, and 6 feet (0.91, and 1.83 m)
, or{{convert|3|, or|6|ft}}3, or 6 feet (0.91, or 1.83 m)
/{{convert|83|/|63|F|disp=br()|abbr=values}}83 / 63
(28 / 17)
Slash with thin spaces for a table of high/low temperatures.
by{{convert|3|by|6|ft}}3 by 6 feet (0.91 by 1.83 m)
by(x){{convert|3|by(x)|6|ft}}3 by 6 feet (0.91 m × 1.83 m)by on left; multiply (×) on right
by(x)|order=flip{{convert|3|by(x)|6|ft|order=flip}}0.91 by 1.83 metres (3 ft × 6 ft)
x{{convert|3|x|6|ft}}3 by 6 feet (0.91 m × 1.83 m)
x|abbr=on{{convert|3|x|6|ft|abbr=on}}3 ft × 6 ft (0.91 m × 1.83 m)|abbr=on displays × instead ofby
xx{{convert|3|xx|6|ft|abbr=on}}3 × 6 ft (0.91 × 1.83 m)Caution, seeMOS:UNITNAMES.

Ranges can use more than two values.

ConvertOutput
{{convert|3|x|4|x|24|in}}3 by 4 by 24 inches (76 mm × 102 mm × 610 mm)
{{convert|3|x|4|to|6+1/2|x|8+3/4|in}}3 by 4 to6+12 by8+34 inches (76 mm × 102 mm to 165 mm × 222 mm)
{{convert|3|xx|4|to|6+1/2|xx|8+3/4|in}}3 × 4 to6+12 × 8+34 inches (76 × 102 to 165 × 222 mm)

Ranges can be specified in the first parameter although writing{{convert|3.2|-|7.5|ha}} would be clearer.

ConvertOutput
{{convert|3.2-7.5|ha}}3.2–7.5 hectares (7.9–18.5 acres)
{{convert|3x4x24|in}}3 by 4 by 24 inches (76 mm × 102 mm × 610 mm)

Extra words

[edit]

Some options provide text that is included in the output, as shown in the following examples.

ConvertOutputDescription
{{convert|4|ft||adj=mid|-long}}4-foot-long (1.2 m)Adjectival with mid-text between input and output(sets|adj=on)
{{convert|40|acre||adj=pre|planted}}40 planted acres (16 ha)Text before the input unit
{{convert|4|m||disp=preunit|+ }}4+ metres (13+ ft)Same text before the input and output units
{{convert|4|m||disp=preunit|+ |or more }}4+ metres (13 or more ft)Different text before the input and output units
{{convert|20|impfloz||disp=x|, approximately }}20 imperial fluid ounces, approximately 570 ml; 19 US fl ozText before the output (replaces the join)
{{convert|100|m||disp=x|/day (|/day)}}100 metres/day (330 ft/day)Text before and after the output (replaces the join)

In each of the above examples, "||" provides an empty output unit which causes the default output to be used. An output unit, possibly empty, must be specified to avoid the template interpreting the extra text as the output unit. For example, using{{convert|4|ft|adj=mid|-long}} has the same effect as using{{convert|4|ft|-long|adj=mid}}, namely that an error would occur because "-long" would be used as the output unit. The following illustrates the error (hover the mouse over the error text to see that the problem is due to "-long" ) and how it may be avoided.

  • {{convert|4|ft|adj=mid|-long}} → 4-foot ([convert: unknown unit])
  • {{convert|4|ft||adj=mid|-long}} → 4-foot-long (1.2 m)
  • {{convert|4|ft| |adj=mid|-long}} → 4-foot-long (1.2 m)
  • {{convert|4|ft|m|adj=mid|-long}} → 4-foot-long (1.2 m)

Displaying "a" or "an" instead of "one"

[edit]

{{one2a}} may be used with{{convert}}

  • {{convert|1|ft|spell=in}} → one foot (0.30 m)
  • {{one2a|{{convert|1|ft|spell=in}}}} → a foot (0.30 m)
  • {{one2a|{{convert|1|in|mm|1|spell=in}}}} → an inch (25.4 mm)

Displaying parts of a conversion

[edit]

The following examples show how to display only a part of the result.

abbr=on (abbreviate) displays unit symbols, not names
ConvertReturnsComponents
{{convert|2|cuyd|m3}}2 cubic yards (1.5 m3)all (default conversion)
{{convert|2|cuyd|m3|abbr=values}}2 (1.5)numbers only
{{convert|2|cuyd|m3|disp=unit}}cubic yardsinput unit name
{{convert|2|cuyd|m3|abbr=on|disp=unit}}cu ydinput unit symbol
{{convert|2|cuyd|m3|disp=unit|adj=on}}cubic-yardinput unit, adjectival (hyphenated)
{{convert|2|cuyd|cuyd|0|disp=out}}2 cu ydinput value, unit (workaround)
{{convert|2|cuyd|m3|disp=out}}1.5 m3output value, symbol
{{convert|2|cuyd|m3|disp=out|abbr=off}}1.5 cubic metresoutput value, name
{{convert|2|cuyd|m3|disp=out|adj=on|abbr=off}}1.5-cubic-metreoutput, adjectival
{{convert|2|cuyd|m3|disp=number}}1.5output number
{{convert|2|cuyd|m3|disp=unit2}}m3output unit (symbol by default)
{{convert|2|cuyd|m3|disp=unit2|abbr=off}}cubic metresoutput unit (name)
{{convert|2|cuyd|m3|disp=unit2|abbr=on}}m3output unit (symbol)

Tables

[edit]

The following parameters are intended for use intables.

ParameterDescription
|disp=tablefor a table cell withalign="right"
|disp=tablecenfor a table cell withalign="center"
|sortable=onoutput a numeric hidden sort field for a sortable table

The following shows the wikitext output by some example converts.

ConvertResulting wikitext
{{convert|47.5|kg|lb}}47.5 kilograms (105 lb)
{{convert|47.5|kg|lb|disp=table}}align="right"|47.5
|align="right"|105
{{convert|47.5|kg|lb|disp=tablecen}}align="center"|47.5
|align="center"|105
{{convert|47.5|kg|lb|sortable=on}}<span>7001475000000000000</span>47.5 kilograms (105 lb)

Fixed table

[edit]

This wikitext:

{|class="wikitable"!align=right,rowspan="2"|!colspan="2"| Length!colspan="2"| Weight|-style="vertical-align:bottom;"!metres!!ft in!!kg!!lb|-! Lorem ipsum|{{convert|28.1|m|ftin|disp=table}}|{{convert|47.5|kg|lb|disp=table}}|-! Dolor sit amet|{{convert|9.9|m|ftin|disp=table}}|{{convert|74.1|kg|lb|disp=table}}|-! Consectetur|{{convert|38.2|m|ftin|disp=table}}|{{convert|31.5|kg|lb|disp=table}}|-! Adipisicing elit|{{convert|18.7|m|ftin|disp=table}}|{{convert|52.7|kg|lb|disp=table}}|}

produces this table:

LengthWeight
metresft inkglb
Lorem ipsum28.192 ft 2 in47.5105
Dolor sit amet9.932 ft 6 in74.1163
Consectetur38.2125 ft 4 in31.569
Adipisicing elit18.761 ft 4 in52.7116

Sortable table

[edit]

This wikitext:

{|class="wikitable sortable"!align=right,rowspan="2"|!colspan="2"| Length!colspan="2"| Weight|-style="vertical-align:bottom;"!metres!!ft in!!kg!!lb|-! Lorem ipsum|{{convert|28.1|m|ftin|disp=table|sortable=on}}|{{convert|47.5|kg|lb|disp=table|sortable=on}}|-! Dolor sit amet|{{convert|9.9|m|ftin|disp=table|sortable=on}}|{{convert|74.1|kg|lb|disp=table|sortable=on}}|-! Consectetur|{{convert|38.2|m|ftin|disp=table|sortable=on}}|{{convert|31.5|kg|lb|disp=table|sortable=on}}|-! Adipisicing elit|{{convert|18.7|m|ftin|disp=table|sortable=on}}|{{convert|52.7|kg|lb|disp=table|sortable=on}}|}

produces this table:

LengthWeight
metresft inkglb
Lorem ipsum28.192 ft 2 in47.5105
Dolor sit amet9.932 ft 6 in74.1163
Consectetur38.2125 ft 4 in31.569
Adipisicing elit18.761 ft 4 in52.7116

Units in singular or plural

[edit]

Unitsymbols never take a plural form. Unitnames can be singular or plural. A unit is singular when the number is exactly 1:

  • {{convert|0.5|ft|m|abbr=off}} → 0.5 feet (0.15 metres)
  • {{convert|1|ft|m|abbr=off}} → 1 foot (0.30 metres)
  • {{convert|2|ft|m|abbr=off}} → 2 feet (0.61 metres)

Parameter list

[edit]
Parameter options for {{convert}}
ParameterValueDescriptionNote
|abbr=ininUse symbol for first (left-hand side) unitUnit display
|abbr=offoffUse name for all unitsUnit display
|abbr=ononUse symbol for all units (default for{{cvt}})Unit display
|abbr=outoutUse symbol for right-hand side unit (default)Unit display
|abbr=unitunitSame asabbr=on but only for units (e6km → "million km")Unit display
|abbr=valuesvaluesShow only the input and output numbers; omit unitsUnit display
|abbr=~~Shows both unit name and symbol for the inputUnit display
|adj=mid|...midUser-specified text after the input unit; setsadj=on (adjectival); requires one unnamed parameterWord adding, adjectival
|adj=ononadjectival; unit name is singular and hyphenatedGrammar, adjectival
|adj=pre|...preUser-specified text before input unit (prefix); requires one unnamed parameterWord adding
|adj=ri0ri0Round input with precision 0Input precision
|adj=ri1ri1Round input with precision 1Input precision
|adj=ri2ri2Round input with precision 2Input precision
|adj=ri3ri3Round input with precision 3Input precision
|altitude_ft=NNSpecifies altitude in feet for a conversion withmach as the input unitQualifier
|altitude_m=NNSpecifies altitude in metres for a conversion withmach as the input unitQualifier
|comma=55Only use comma for thousands separator if 5 or more digitsNumber format
|comma=gapsgapsUse gaps (space), not comma, for thousands separatorNumber format
|comma=offoffNo thousands separator (raw number)Number format
|disp=bbJoin input and output using " (...)" (default)Join values
|disp=sqbrsqbrJoin input and output using " [...]"Join values
|disp=brbrJoin input and output using "<br />"Join values
|disp=br()brJoin input and output using "<br />(...)"Join values
|disp=commacommaJoin input and output using ", "Join values
|disp=semicolonsemicolonJoin input and output using "; "Join values
|disp=ororJoin input and output using " or "Join values
|disp=(or)orJoin input and output using " (...)" but with "or" between outputs in a combinationJoin values
|disp=numbernumberDisplay output number onlyParts only
|disp=output number onlyoutput number only
|disp=outoutDisplay only output number and name/symbolParts only
|disp=output onlyoutput only
|disp=preunit|...[|...]preunitText to be inserted after value and before units, for both input and output, with optionally different text for output; requires 1 or 2 unnamed parametersWord adding
|disp=tabletableOutput is suitable for a table cell with align="right"Table columns
|disp=tablecentablecenOutput is suitable for a table cell with align="center"Table columns
|disp=unitunitDisplay input name/symbol only (not input number, not output)Parts only
|disp=unit2unit2Display output name/symbol only (not input; not output number)Parts only
|disp=x|...xJoin input and output using one (or two) unnamed parameter(s) before (and after) the outputWord adding
|error=xany textThis has no effect if the conversion works; if a conversion error occurs, the result isx (and the original error message is suppressed)Inside template
|frac=N34(e.g.)Show number as a fraction with denominatorNNumber format, fraction
|frac=-N3/4(e.g.)Show number as a fraction with a horizontal barNumber format, fraction
|input=P2048P2048(e.g.)Reads and converts a Wikidata propertyInside template
|lk=ininLink left-hand side unit name or symbolUnit link
|lk=ononLink all unit names or symbols (but not twice for the same unit)Unit link
|lk=outoutLink right-hand side unit name or symbolUnit link
|order=flipflipSwaps the order of the input and output measurementsOrder
|order=outoutDisplays output units in the order entered, skipping input unitOrder
|qid=Q1056131Q1056131(e.g.)Specifies the Wikidata entity to be used with a property such asinput=P2048Inside template; testing
|qual=Q613628Q613628(e.g.)Specifies a statement qualifier for a Wikidata propertyQualify Wikidata property
|round=NNRounds output value to nearestN which can be0.5 or5 or10 or25 or50Output precision
|round=eacheachIn a range, round each number separately rather than selecting the same rounding precisionOutput precision
|sigfig=NNRound output number toN significant figures (N is a positive integer)Output precision
|sortable=ononAdds an invisible sort keyTable sort
|sp=ususUse U.S. spelling ("meter" instead of default "metre")Spelling U.S. names
|spell=ininSpell input number in wordsSpelling numbers
|spell=InInSpell input number in words with first letter uppercaseSpelling numbers
|spell=ononSpell input and output numbers in wordsSpelling numbers
|spell=OnOnSpell input and output numbers in words with first letter uppercaseSpelling numbers
|$=€Replace $-sign with a currency sign, for example in€/hectareCost per unit
No currency conversion happens
|debug=yesyesDebugging only. In a sortable table: show the normally hidden sort keyTable sort
|disp=flipflipDeprecated. Use|order=flipOrder
|sing=Deprecated. Use|adj=Plurals

Complicated grammar

[edit]

This example is from articleFort McHenry:

The American defenders had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons.

This result cannot reasonably be produced by{{convert}}. However, convert can be used to construct the required text.

  • Use{{convert}} withsubst to insert the required wikitext into the article oryour sandbox.
    had {{subst:convert|18|,|24|,|32|lb|kg|0}} cannons
    → had 18, 24, 32 pounds (8, 11, 15 kg) cannons
  • When the edit is saved, the convert template is replaced with the result.
  • Edit the result to produce the final text.
    → had 18-, 24- and 32-pounder (8, 11 and 15 kg) cannons

An alternative to subst would be to enter{{convert|18|,|24|,|32|lb|kg|0}} intoSpecial:ExpandTemplates, then copy and edit its result into the article.

Limitations

[edit]

This is a list of features that the module may be expected to support, but which will not work.

Composite units cannot be used in a range:

If an expression is wanted, it has to begin with{{#expr:...}}:

  • {{convert|3*12|ft|mm}} → 3×12 feet (910×3,660 mm)
  • {{convert|{{#expr:3*12}}|ft|mm}} → 36 feet (11,000 mm)
{{Convert}} help, documentation and maintenance
Help
Documentation
Units
Error tracking
Modules
See also
Module:Convert/helper (preprocess height input)
Related
About Wikipedia (?)
Help for readers (?)
Contributing
to Wikipedia
 (?)
Getting started (?)
Dos and don'ts (?)
How-to pages and
information pages (?)
Coding (?)
Directories (?)
Retrieved from "https://en.wikipedia.org/w/index.php?title=Help:Convert&oldid=1314585717"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp