Plantilla:Duration
Ir a la navegación
Ir a la búsqueda
Documentation The documentation below is transcluded from Plantilla:Duration/doc. (edit | history)
[purge]
Format a time value, input in seconds.
Usage
{{ duration | <time in seconds/ticks> | <maximum unit> | round = <rounding level> }}
- First unnamed parameter
Number, any valid {{#expr:}}
string is accepted. By default interpreted as time in seconds, unless the number is followed by any of the strings
/t
/tick
, in which case the value is interpreted as time in ticks.
ticks
- Second unnamed parameter
Greatest unit of the output. Can be any of
, seconds
(default), minutes
, hours
, and days
, or weeks
, s
, m
, h
, and d
for short, respectively.
w
- round
Rounding level for decimal seconds,
by default.
2
Notes
- The template does not support specifying a lowest unit of the output. Instead, this can easily be achieved by rounding the number of seconds divided by the number of seconds in the target unit, then multiplying that value by the target unit again. For example, to display
(1 hora 1 minuto 1 segundo) in only hours and minutes, use3661
. To round down or up, use(3661 / 60 round 0) * 60
orfloor()
instead ofceil()
, respectively. To set the lowest unit to hours, useround 0
instead of3600
, and60
for days. See below for examples.86400
Examples
Code | Result |
---|---|
{{duration|41}} |
41 segundos |
{{duration|40.75}} |
40,75 segundos |
{{duration|90}} |
1 minuto 30 segundos |
{{duration|1800}} |
30 minutos |
{{duration|7201}} |
120 minutos 1 segundo |
{{duration|604800}} |
10 080 minutos |
{{duration|604800|weeks}} |
1 semana |
{{duration|7201|weeks}} |
2 horas 1 segundo |
{{duration|604800|d}} |
7 días |
{{duration|7201|w}} |
2 horas 1 segundo |
{{duration|2/3}} |
0,67 segundos |
{{duration|2/3|round=6}} |
0,666667 segundos |
{{duration|(35/11 mod 2) - (10^-2 / pi*3) + ceil(21/6)}} |
4,99 segundos |
{{duration|{{#time:U|+3 days 2 hours 44 minutes 23 seconds}}-{{#time:U}}|days}} |
3 días 2 horas 44 minutos 24 segundos |
{{duration|{{#time:U|+2 days 37 hours 98 minutes 63 seconds}}-{{#time:U}}|hours}} |
86 horas 39 minutos 4 segundos |
{{duration|-41}} |
−41 segundos |
{{duration|-3601|days}} |
−1 hora 1 segundo |
{{duration|0}} |
0 segundos |
{{duration|0.001}} |
0 segundos |
{{duration|-0.001}} |
−0 segundos |
{{duration|0.001|round=5}} |
0,001 segundos |
{{duration|60t}} |
1 segundo |
{{duration|20tick}} |
0,33 segundos |
{{duration| 30 Ticks }} |
0,5 segundos |
{{duration|140ticks|round=4}} |
2,3333 segundos |
{{duration|694921|days}} |
8 días 1 hora 2 minutos 1 segundo |
{{duration|(694921 / 3600 round 0) * 3600|days}} |
8 días 1 hora |
{{duration|ceil(694921 / 3600) * 3600|days}} |
8 días 2 horas |
{{duration|(694921 / 86400 round 0) * 86400|days}} |
8 días |