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
{{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
| 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
|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
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
- {{Duration}} — SI / APA-style rendering (
hr/min/s). - {{Time interval}} — computes the interval between two dates.
- {{Age}} — for ages computed from a date.
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.