Template:TimeHMS: Difference between revisions
From Melvor Idle
(Created page with "Takes in a number of seconds and converts it into "X days, H:M:S" For example, {{T|Time|90135}} becomes {{Time|90135}}. This is a convenience function for Template:Time. This uses a function inside of Module:Common.<onlyinclude><includeonly>{{#invoke:common|prettyPrintTime|{{{1}}}|hms=true}}</includeonly></onlyinclude>") |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<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}}}}<!-- | |||
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> |
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.