Difference between revisions of "Template:Duration/doc"
(Created page with "{{Doc/start}} Formats a duration given in seconds. Seconds will be rounded to 3 digits. ===Usage=== <nowiki>{{duration|s|format}}</nowiki> If the second parameter is given...") |
Skylord1496 (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
===Usage=== |
===Usage=== |
||
<nowiki>{{duration|s|format}}</nowiki> |
<nowiki>{{duration|s|format}}</nowiki> |
||
+ | *If the second parameter "hhmm" is given , the format will be like hh:mm, hh been the total number of hours including days. |
||
− | |||
− | If the second parameter is given |
+ | *If the second parameter "ddhhmm" is given , the format will be like dd hh:mm if the duration is longer than a day, otherwise the format will be like hh:mm. |
+ | *If any other second parameter is given (any non-whitespace character), the format will be like dd:hh:mm:ss. |
||
+ | *If the second parameter is empty, the format will be like 1d 4h 23m 2s. |
||
===Examples=== |
===Examples=== |
||
Line 15: | Line 17: | ||
* <code><nowiki>{{duration|86406|f}}</nowiki></code> creates {{duration|86406|f}} |
* <code><nowiki>{{duration|86406|f}}</nowiki></code> creates {{duration|86406|f}} |
||
* <code><nowiki>{{duration|118518.515625}}</nowiki></code> creates {{duration|118518.515625}} |
* <code><nowiki>{{duration|118518.515625}}</nowiki></code> creates {{duration|118518.515625}} |
||
+ | * <code><nowiki>{{duration|118518.515625|hhmm}}</nowiki></code> creates {{duration|118518.515625|hhmm}} |
||
+ | * <code><nowiki>{{duration|118518.515625|ddhhmm}}</nowiki></code> creates {{duration|118518.515625|ddhhmm}} |
||
* <code><nowiki>{{duration|118518.515625|f}}</nowiki></code> creates {{duration|118518.515625|f}} |
* <code><nowiki>{{duration|118518.515625|f}}</nowiki></code> creates {{duration|118518.515625|f}} |
||
{{Doc/end}} |
{{Doc/end}} |
Latest revision as of 20:04, 12 July 2019
Formats a duration given in seconds. Seconds will be rounded to 3 digits.
Usage
{{duration|s|format}}
- If the second parameter "hhmm" is given , the format will be like hh:mm, hh been the total number of hours including days.
- If the second parameter "ddhhmm" is given , the format will be like dd hh:mm if the duration is longer than a day, otherwise the format will be like hh:mm.
- If any other second parameter is given (any non-whitespace character), the format will be like dd:hh:mm:ss.
- If the second parameter is empty, the format will be like 1d 4h 23m 2s.
Examples
{{duration|20}}
creates 20s{{duration|140}}
creates 2m 20s{{duration|86406}}
creates 1d 6s{{duration|20|f}}
creates 20{{duration|140|f}}
creates 2:20{{duration|86406|f}}
creates 1:00:00:06{{duration|118518.515625}}
creates 1d 8h 55m 18.516s{{duration|118518.515625|hhmm}}
creates 32:55{{duration|118518.515625|ddhhmm}}
creates 1d 08:55{{duration|118518.515625|f}}
creates 1:08:55:18.516