User:Stux/sandbox2
From Homestar Runner Wiki
(Difference between revisions)
(Testing time) |
(Manual time approach) |
||
| Line 13: | Line 13: | ||
</pre> | </pre> | ||
'''Yields:''' {{#time: i:s | 121}} | '''Yields:''' {{#time: i:s | 121}} | ||
| + | |||
| + | * So time doesn't support converting seconds to "hh:mm:ss" format, unfortunately. We gotta do it manually using [[Help:ParserFunctions##expr:]], but now we have two more problems: | ||
| + | ** There is no {{w|modulo}} operation, and we can't use "round" to easily emulate it. | ||
| + | ** So, here goes nothing: | ||
| + | |||
| + | <pre> | ||
| + | {{#expr: 121%60}} <br/><!-- confirm there is no modulo --> | ||
| + | {{#expr: 121 mod 60}} <br/><!-- confirm there is no modulo --> | ||
| + | |||
| + | |||
| + | {{#expr: 121/60}} <br/><!-- convert 121 seconds to minutes --> | ||
| + | {{#expr: 119/60}} <br/><!-- convert 119 seconds to minutes --> | ||
| + | {{#expr: 121/60 round 0}} <br/><!-- round 121 seconds to minutes --> | ||
| + | {{#expr: 119/60 round 0}} <br/><!-- round 119 seconds to minutes --> | ||
| + | </pre> | ||
| + | |||
| + | {{#expr: 121%60}} <br/><!-- confirm there is no modulo --> | ||
| + | {{#expr: 121 mod 60}} <br/><!-- confirm there is no modulo --> | ||
| + | |||
| + | |||
| + | {{#expr: 121/60}} <br/><!-- convert 121 seconds to minutes --> | ||
| + | {{#expr: 119/60}} <br/><!-- convert 119 seconds to minutes --> | ||
| + | {{#expr: 121/60 round 0}} <br/><!-- round 121 seconds to minutes --> | ||
| + | {{#expr: 119/60 round 0}} <br/><!-- round 119 seconds to minutes --> | ||
| + | |||
| + | * Fortunately, we should be able to use the above logic for IF statements. ''Unfortunately'', this crazy logic may time out... | ||
---- | ---- | ||
Revision as of 21:32, 1 January 2025
Testing time:
{{#time: z | 20071031}}
Yields: 303
- 121 seconds?
{{#time: i:s | 121}}
Yields: Error: invalid time
- So time doesn't support converting seconds to "hh:mm:ss" format, unfortunately. We gotta do it manually using Help:ParserFunctions##expr:, but now we have two more problems:
- There is no modulo operation, and we can't use "round" to easily emulate it.
- So, here goes nothing:
{{#expr: 121%60}} <br/><!-- confirm there is no modulo -->
{{#expr: 121 mod 60}} <br/><!-- confirm there is no modulo -->
{{#expr: 121/60}} <br/><!-- convert 121 seconds to minutes -->
{{#expr: 119/60}} <br/><!-- convert 119 seconds to minutes -->
{{#expr: 121/60 round 0}} <br/><!-- round 121 seconds to minutes -->
{{#expr: 119/60 round 0}} <br/><!-- round 119 seconds to minutes -->
Expression error: Unrecognised punctuation character "%"
1
2.0166666666667
1.9833333333333
2
2
- Fortunately, we should be able to use the above logic for IF statements. Unfortunately, this crazy logic may time out...
