Template:Duration/doc

From Foundry Wiki
< Template:Duration
Revision as of 01:21, 26 June 2022 by Naginreed (talk | contribs) (Created page with "{{Doc/start}} Formats a duration given in seconds. ===Usage=== <nowiki>{{duration|s|format}}</nowiki> If the second parameter is given (any non-whitespace character will do), the format will be like dd:hh:mm:ss. If the second parameter is empty, the format will be like 1d 4h 23m 2s. Seconds will be rounded to 3 digits. ===Examples=== * <code><nowiki>{{duration|20}}</nowiki></code> creates {{duration|20}} * <code><nowiki>{{duration|140}}</nowiki></code> creates {{durat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Template-info.png Documentation

Formats a duration given in seconds.

Usage

{{duration|s|format}}

If the second parameter is given (any non-whitespace character will do), the format will be like dd:hh:mm:ss. If the second parameter is empty, the format will be like 1d 4h 23m 2s. Seconds will be rounded to 3 digits.

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|f}} creates 1:08:55:18.516
  • {{duration|}} (duration is not specified) creates ?

This is the documentation page, it should be transcluded into the main template page. See Template:Doc for more information.