Plantilla:Duration/doc

De Terraria Wiki
Ir a la navegación Ir a la búsqueda

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/ticks, in which case the value is interpreted as time in ticks.

Second unnamed parameter

Greatest unit of the output. Can be any of seconds, minutes (default), hours, days, and weeks, or s, m, h, d, and w for short, respectively.

round

Rounding level for decimal seconds, 2 by default.

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 3661 (1 hora 1 minuto 1 segundo) in only hours and minutes, use (3661 / 60 round 0) * 60. To round down or up, use floor() or ceil() instead of round 0, respectively. To set the lowest unit to hours, use 3600 instead of 60, and 86400 for days. See below for examples.

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 23 segundos
{{duration|{{#time:U|+2 days 37 hours 98 minutes 63 seconds}}-{{#time:U}}|hours}} 86 horas 39 minutos 3 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