Template:hmss
From Homestar Runner Wiki
(Difference between revisions)
(Create new helper template; I don't know why I didn't think of this before...) |
|||
Line 7: | Line 7: | ||
-->}}<!-- /* End three terms: {{#if:{{{3|}}}. */ | -->}}<!-- /* End three terms: {{#if:{{{3|}}}. */ | ||
--><noinclude> | --><noinclude> | ||
- | '''Convert Hours+Minutes+Seconds (HH:MM:SS) to Seconds''' | + | '''Convert Hours+Minutes+Seconds (HH:MM:SS) to Seconds''' |
- | * This template takes an input in Hours, Minutes and Seconds and returns the total number of seconds represented by that time period. | + | * This template takes an input in Hours, Minutes, and Seconds, and returns the total number of seconds represented by that time period. |
** That is, 60 seconds in a minute, and 60 minutes in an hour. | ** That is, 60 seconds in a minute, and 60 minutes in an hour. | ||
* Note that both Hours and Minutes are optional. | * Note that both Hours and Minutes are optional. | ||
Line 17: | Line 17: | ||
* <code><nowiki>{{</nowiki> hmss | ''minutes'' | ''seconds'' }}</code> | * <code><nowiki>{{</nowiki> hmss | ''minutes'' | ''seconds'' }}</code> | ||
* <code><nowiki>{{</nowiki> hmss | ''seconds'' }}</code> | * <code><nowiki>{{</nowiki> hmss | ''seconds'' }}</code> | ||
- | * The last entry is redundant but left for completeness. | + | * The last entry is redundant, but left for completeness. |
''' Examples:''' | ''' Examples:''' |
Current revision as of 23:50, 6 January 2025
{{{1}}} Convert Hours+Minutes+Seconds (HH:MM:SS) to Seconds
- This template takes an input in Hours, Minutes, and Seconds, and returns the total number of seconds represented by that time period.
- That is, 60 seconds in a minute, and 60 minutes in an hour.
- Note that both Hours and Minutes are optional.
Usage:
- The template may be used one of three ways.
-
{{ hmss | hours | minutes | seconds }}
-
{{ hmss | minutes | seconds }}
-
{{ hmss | seconds }}
- The last entry is redundant, but left for completeness.
Examples:
* {{hmss|30}} * {{hmss|59}} * {{hmss|1|00}} * {{hmss|1|30}} * {{hmss|1|59}} * {{hmss|2|00}} * {{hmss|10|00}} * {{hmss|30|00}} * {{hmss|59|00}} * {{hmss|59|59}} * {{hmss|1|00|00}} * {{hmss|1|00|01}} * {{hmss|1|30|00}} * {{hmss|2|00|00}} * {{hmss|10|00|00}}
Yields:
- 30
- 59
- 60
- 90
- 119
- 120
- 600
- 1800
- 3540
- 3599
- 3600
- 3601
- 5400
- 7200
- 36000