Terraria Wiki
Advertisement
Terraria Wiki
3,710
个页面
This template is i18n-ready, which means it is easy to localize for different languages. Please see i18n & l10n for templates to learn more.
See Template:Duration/l10n for the localization of this template.
Template-info.svg 文档 以下文档内容来自模板:Duration/doc。 (edit | history)

Format a time value, input in seconds.

Usage

{{ duration | <time in seconds> | <maximum unit> | round = <rounding level> }}

First unnamed parameter

Number, time in seconds. Any valid {{#[[[:Template:Tl/parser function links]]##expr expr]:}} string is accepted.

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.

Examples

Code Result
{{duration|41}} 41 秒
{{duration|40.75}} 40.75 秒
{{duration|90}} 1 分 30 秒
{{duration|1800}} 30 分
{{duration|7201}} 120 分 1 秒
{{duration|604800}} 10,080 分
{{duration|604800|weeks}} 1 周
{{duration|7201|weeks}} 2 小时 1 秒
{{duration|604800|d}} 7 天
{{duration|7201|w}} 2 小时 1 秒
{{duration|1/3}} 0.33 秒
{{duration|1/3|round=6}} 0.333333 秒
{{duration|(35/11 mod 2) - (10^-2 / pi*3) + ceil(21/6)}} 4.99 秒
{{duration|{{#[[[:Template:Tl/parser function links]]##time time]:U|+3 days 2 hours 44 minutes 23 seconds}}-{{#time:U}}|days}} 3 天 2 小时 44 分 24 秒
{{duration|{{#time:U|+2 days 37 hours 98 minutes 63 seconds}}-{{#time:U}}|hours}} 86 小时 39 分 4 秒
{{duration|-41}} −41 秒
{{duration|-3601|days}} −1 小时 1 秒
{{duration|0}} 0 秒
{{duration|0.001}} 0 秒
{{duration|-0.001}} −0 秒
{{duration|0.001|round=5}} 0.001 秒
Advertisement