ARK: Survival Evolved Wiki
Mirageionova (discusión | contribs.)
Mirageionova (discusión | contribs.)
Línea 1: Línea 1:
  +
<includeonly>{{#vardefine:input|{{{1|}}}}}<!--
<includeonly>{{#vardefine:input|{{{1|}}}}}{{#vardefine:time|{{#var:input}}}}{{#vardefine:days|{{#expr:({{#var:time}} - {{#var:time}} mod 86400) / 86400}}}}{{#vardefine:time|{{#expr:{{#var:time}} - {{#var:days}} * 86400}}}}{{#vardefine:hours|{{#expr:({{#var:time}} - {{#var:time}} mod 3600) / 3600}}}}{{#vardefine:time|{{#expr:{{#var:time}} - {{#var:hours}} * 3600}}}}{{#vardefine:minutes|{{#expr:({{#var:time}} - {{#var:time}} mod 60) / 60}}}}{{#vardefine:seconds|{{#expr:{{#var:time}} - {{#var:minutes}} * 60}}}}{{#ifexpr: {{#var:input}} >= 86400 | {{#var:days}}d }} {{#ifexpr: {{#var:input}} >= 3600 | {{#ifexpr: {{#var:hours}} > 0 | {{#var:hours}}h | }} }} {{#ifexpr: {{#var:input}} >= 60 | {{#ifexpr: {{#var:minutes}} > 0 | {{#var:minutes}}m | }} }} {{#ifexpr: {{#var:seconds}} < 60 | {{#ifexpr: {{#var:seconds}} > 0 | {{#var:seconds}}s | }} | }}</includeonly>
 
  +
-->{{#vardefine:time|{{#var:input}}}}<!--
  +
-->{{#vardefine:days|{{#expr:floor({{#var:time}} / 86400)}}}}<!--
  +
-->{{#vardefine:hourstotal|{{#expr:floor({{#var:time}} / 3600)}}}}<!--
  +
-->{{#vardefine:time|{{#expr:{{#var:time}} - {{#var:days}} * 86400}}}}<!--
  +
-->{{#vardefine:hours|{{#expr:floor({{#var:time}} / 3600)}}}}<!--
  +
-->{{#vardefine:time|{{#expr:{{#var:time}} - {{#var:hours}} * 3600}}}}<!--
  +
-->{{#vardefine:minutes|{{#expr:floor({{#var:time}} / 60)}}}}<!--
  +
-->{{#vardefine:seconds|{{#expr:{{#var:time}} - {{#var:minutes}} * 60 round 3}}}}<!--
   
  +
-->{{#if:{{{2|}}}|<!-- with second parameter, i.e. dd:hh:mm:ss
<noinclude>{{doc}}
 
  +
-->{{#ifeq:{{{2|}}}|hhmm|<!-- with specific second parameter hhmm
  +
-->{{#ifexpr: {{#var:input}} >= 3600 | {{#var:hourstotal}}: }}<!--
  +
-->{{#ifexpr: {{#var:input}} >= 60 | {{#ifexpr: {{#var:input}} < 3600 | {{#var:minutes}} | {{padleft:{{#var:minutes}}|2|0}} }} }}
  +
|{{#ifeq:{{{2|}}}|ddhhmm|<!-- with specific second parameter ddhhmm
  +
-->{{#ifexpr: {{#var:input}} >= 86400 | {{#var:days}}d }} <!--
  +
-->{{#ifexpr: {{#var:input}} >= 3600 | {{#ifexpr: {{#var:input}} < 86400 | {{#var:hours}}: | {{padleft:{{#var:hours}}|2|0}}: }} | 0: }}<!--
  +
-->{{#ifexpr: {{#var:input}} >= 60 | {{#ifexpr: {{#var:input}} < 3600 | {{#var:minutes}} | {{padleft:{{#var:minutes}}|2|0}} }} }}
  +
|<!-- with non-specific second parameter, i.e. f
  +
-->{{#ifexpr: {{#var:input}} >= 86400 | {{#var:days}}: }}<!--
  +
-->{{#ifexpr: {{#var:input}} >= 3600 | {{#ifexpr: {{#var:input}} < 86400 | {{#var:hours}}: | {{padleft:{{#var:hours}}|2|0}}: }} }}<!--
  +
-->{{#ifexpr: {{#var:input}} >= 60 | {{#ifexpr: {{#var:input}} < 3600 | {{#var:minutes}}: | {{padleft:{{#var:minutes}}|2|0}}: }} }}<!--
  +
-->{{#ifexpr: {{#var:input}} < 60 | {{#var:seconds}} | {{padleft:{{#var:seconds}}|2|0}} }}
  +
}}}}|<!-- without second parameter, i.e. like 1d 2h 3m 4s
  +
-->{{#ifexpr: {{#var:input}} >= 86400 | {{#var:days}}d }} <!--
  +
-->{{#ifexpr: {{#var:input}} >= 3600 | {{#ifexpr: {{#var:hours}} > 0 | {{#var:hours}}h | }} }} <!--
  +
-->{{#ifexpr: {{#var:input}} >= 60 | {{#ifexpr: {{#var:minutes}} > 0 | {{#var:minutes}}m | }} }} <!--
  +
-->{{#ifexpr: {{#var:seconds}} > 0 | {{#var:seconds}}s | }}
  +
}}</includeonly>
   
 
<noinclude>{{doc}}
[[Categoría:Plantillas de formato‎]]
+
[[Category:Plantillas de formato]]
 
[[en:Template:Duration]]</noinclude>
 
[[en:Template:Duration]]</noinclude>

Revisión del 16:30 7 dic 2020


Template-info.png Documentación

Formats a duration given in seconds.

Usage

{{duration|s}}

Examples

  • {{duration|20}} creates 20s


  • {{duration|140}} creates 2m 20s


  • {{duration|86406}} creates 1d 6s