User:Medyro/Template/Format duration
From Guild Wars 2 Wiki
< User:Medyro | Template
Jump to navigationJump to search
Description[edit]
Formats a duration given in seconds into days, hours, minutes and seconds, starting with the largest of the aforementioned durations that isn't zero, or the smallest unit.
Usage[edit]
{{User:Medyro/Template/Format duration|<duration in seconds>}} {{User:Medyro/Template/Format duration|s=n|<duration in seconds>}}
Parameters[edit]
- 1 (unnamed parameter)
- A duration in seconds.
- s
- Set to
n
to hide the seconds and make minutes the smallest unit displayed.
Examples[edit]
* {{User:Medyro/Template/Format duration|420}} * {{User:Medyro/Template/Format duration|86640}} * {{User:Medyro/Template/Format duration|3600}} * {{User:Medyro/Template/Format duration|s=n|3600}}
- 7m 0s
- 1d 0h 4m 0s
- 1h 0m 0s
- 1h 0m
* {{User:Medyro/Template/Format duration|0}} * {{User:Medyro/Template/Format duration|1}} * {{User:Medyro/Template/Format duration|s=n|0}} * {{User:Medyro/Template/Format duration|s=n|59}} * {{User:Medyro/Template/Format duration|s=n|60}}
- 0s
- 1s
- 0m
- 0m
- 1m