User talk:Thinboy00/Swatch timestamp
From Wikipedia, the free encyclopedia
[edit] ParserFunctions explained
@{{<includeonly>subst:</includeonly>#expr: (((({{<includeonly>subst:</includeonly>#time:s}}) / 60) / 60 + {{<includeonly>subst:</includeonly>#time:i}} / 60 + ({{<includeonly>subst:</includeonly>#time:G}} + 1) <includeonly>subst:</includeonly>mod 24) / 24 * 1000) round 0}}
At first, this appears to be a daunting array of meaningless code, but it's actually quite simple:
<includeonly>subst:</includeonly>
means substitute this only when transcluding or substituting. Substituting when transcluding gives an error.{{#expr:((((
means "treat the following as a mathematical expression, using specified syntax at meta:Help:ParserFunctions and meta:Help:Calculation.{{#time:s}}) / 60) / 60
means seconds converted to hours{{#time:i}} / 60
means minutes converted to hours({{#time:G}} + 1) mod 24)
this means hours in 24 hour format, converted to BMT or GMT + 1, and converts 24:00 into 0:00/ 24 * 1000) round 0}}
convert to .beats, remove resulting decimal point and prevent decimal results.
for more information, please see meta:Help:ParserFunctions. -- Thinboy00 talk/contribs 00:08, 19 October 2007 (UTC)
- more specifically,
<includeonly>subst:</includeonly>
prevents it from being subst'ed until inclusion, but not quite the way you might think, see meta:Help:Substitution#Includeonly. This is not a novel technique and has been used in many templates. -- Thinboy00 talk/contribs 00:47, 19 October 2007 (UTC)