Template:TimeHMS
This template renders a duration in hours / minutes / seconds using prime (′) and double-prime (″) symbols, e.g. 1h 23' 45". It is typically used inline in prose, references or infobox fields where a compact, language-neutral duration is wanted.
For a digital-clock-style rendering (e.g. 14:50) see {{Duration}}.
Usage
[edit]{{TimeHMS|hours|minutes|seconds}}
{{TimeHMS||minutes|seconds}}
{{TimeHMS|||seconds|fraction}}
Empty positional slots are skipped, so any combination of hours, minutes and seconds renders correctly. An optional fourth parameter holds decimal seconds and is concatenated to |3= with a period.
Examples
[edit]| Wikitext | Result |
|---|---|
{{TimeHMS|1|23|45}} | 1h 23' 45" |
{{TimeHMS|2|30}} | 2h 30' |
{{TimeHMS||14|50}} | 14' 50" |
{{TimeHMS||27}} | 27' |
{{TimeHMS|||45}} | 45" |
{{TimeHMS|||3|14}} | 3.14" |
{{TimeHMS|1}} | 1h |
Parameters
[edit]|1=- Hours. Rendered with a trailing h. Omit (pass an empty positional slot) when the duration is shorter than an hour.
|2=- Minutes. Rendered with a trailing prime (′).
|3=- Seconds. Rendered with a trailing double-prime (″).
|4=- Decimal fraction of seconds, concatenated to
|3=with a period (e.g.|3=3|4=14renders as 3.14″). Only honored when|1=is empty.
The full output is wrapped in {{nowrap}} so the value does not break across lines.
TemplateData
[edit]Renders a duration using hours/minutes/seconds with prime and double-prime symbols (e.g. 1h 23' 45").
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Hours | 1 | Number of hours. Leave the positional slot empty when not needed. | Number | suggested |
| Minutes | 2 | Number of minutes. | Number | suggested |
| Seconds | 3 | Number of seconds. | Number | optional |
| Decimal fraction of seconds | 4 | Digits appended to the seconds value with a period — e.g. 3 + 14 -> 3.14″. Only honored when hours is empty. | Number | optional |
See also
[edit]- {{Duration}} — SI / APA-style rendering (
hr/min/s). - {{Time interval}} — computes the interval between two dates.
- {{Age}} — for ages computed from a date.