Template:TimeHMS: Difference between revisions
From Melvor Idle
(Prefer template instead of module.) |
No edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude><includeonly><!-- | <onlyinclude><includeonly><!-- | ||
Definition of variables-->{{#vardefine:Time|{{formatnum:{{{1|}}}|R}}}}{{#vardefine:Days|{{#expr:floor({{#var:Time}} / 86400)}}}}{{#vardefine:Time|{{#expr:{{#var:Time}} mod 86400}}}}{{#vardefine:Hours|{{#expr:floor({{#var:Time}} / 3600)}}}}{{#vardefine:Time|{{#expr:{{#var:Time}} mod 3600}}}}{{#vardefine:Minutes|{{#expr:floor({{#var:Time}} / 60)}}}}{{#vardefine:Time|{{#expr:{{#var:Time}} mod 60}}}}{{#vardefine:Seconds|{{#var:Time}}}}<!-- | Definition of variables-->{{#vardefine:Time|{{formatnum:{{{1|}}}|R}}}}{{#vardefine:Days|{{#expr:floor({{#var:Time}} / 86400)}}}}{{#vardefine:Time|{{#expr:{{#var:Time}} mod 86400}}}}{{#vardefine:Hours|{{#expr:floor({{#var:Time}} / 3600)}}}}{{#vardefine:Time|{{#expr:{{#var:Time}} mod 3600}}}}{{#vardefine:Minutes|{{#expr:floor({{#var:Time}} / 60)}}}}{{#vardefine:Time|{{#expr:{{#var:Time}} mod 60}}}}{{#vardefine:Seconds|{{#var:Time}}}}<!-- | ||
Output of template into x day(s), hh:mm:ss--> | Output of template into x day(s), hh:mm:ss--> | ||
{{#ifexpr:{{#var:Days}} > 0|{{#var:Days}} day{{#ifexpr:{{#var:Days}}<>1|s}}, }}{{#ifexpr:{{#var:Hours}} < 10|0{{#var:Hours}}|{{#var:Hours}}}}:{{#ifexpr:{{#var:Minutes}} < 10|0{{#var:Minutes}}|{{#var:Minutes}}}}:{{#ifexpr:{{#var:Seconds}} < 10|0{{#var:Seconds}}|{{#var:Seconds}}}}</includeonly></onlyinclude><noinclude>{{/doc}}</noinclude> | {{#ifexpr:{{#var:Days}} > 0|{{#var:Days}} day{{#ifexpr:{{#var:Days}}<>1|s}}, }}{{#ifexpr:{{#var:Hours}} < 10|0{{#var:Hours}}|{{#var:Hours}}}}:{{#ifexpr:{{#var:Minutes}} < 10|0{{#var:Minutes}}|{{#var:Minutes}}}}:{{#ifexpr:{{#var:Seconds}} < 10|0{{#var:Seconds}}|{{#var:Seconds}}}}</includeonly></onlyinclude><noinclude>{{/doc}}</noinclude> |
Latest revision as of 20:32, 1 April 2024
Takes in a number of seconds and converts it into "X days, H:M:S"
For example, {{TimeHMS|90135}}
becomes
1 day, 01:02:15. This is the shorthand notation variant for Template:Time.