Difference between revisions of "Template:THDayofWeek"
From Twilight Heroes Wiki
m (re-fixing linebreak issue) |
m (Added for EVALUATION statement) |
||
Line 1: | Line 1: | ||
− | <!-- This function works by finding the number of days which have elapsed since the 16th November 2008, which was a Sunday, and which also was the day after this function was (first) made. --><includeonly>{{#switch: <!-- SWITCH for determining name of day --> | + | <!-- This function works by finding the number of days which have elapsed since the 16th November 2008, which was a Sunday, and which also was the day after this function was (first) made. --><includeonly>{{#if:{{{1}}} <!-- for an EVALUATION statement, if argument exists --> |
+ | |{{#switch: <!-- SWITCH for determining name of day --> | ||
+ | {{#expr: | ||
+ | ( | ||
+ | {{#time: j | {{{1}}}}} | ||
+ | + {{#switch:{{#time: n | {{{1}}}}}|01=0|02=31|03=59|04=90|05=120|06=151|07=181|08=212|09=243|10=273|11=304|12=334}} | ||
+ | + ({{#time: Y | {{{1}}}}} - 2004) * 365 | ||
+ | + ((({{#time: Y | {{{1}}}}} - 2006) / 4) round 0) | ||
+ | - (({{#time: Y | {{{1}}}}} mod 4 = 0) and (({{#time: n | {{{1}}}}} = 01) or ({{#time: n | {{{1}}}}} = 02))) | ||
+ | - 1776 <!-- Day number for the 16th November 2008 using this formula --> | ||
+ | ) mod 6}} | ||
+ | |0=Sunday | ||
+ | |1=Moonday | ||
+ | |2=Thewsday | ||
+ | |3=Winsday | ||
+ | |4=Starsday | ||
+ | |5=Frayday | ||
+ | }} | ||
+ | |{{#switch: <!-- SWITCH for determining name of day --> | ||
{{#expr: | {{#expr: | ||
( | ( | ||
Line 16: | Line 34: | ||
|4=Starsday | |4=Starsday | ||
|5=Frayday | |5=Frayday | ||
− | }}</includeonly><noinclude> | + | }}}}</includeonly><noinclude> |
==Variable== | ==Variable== | ||
Returns the day of the week in the game of today | Returns the day of the week in the game of today | ||
+ | |||
+ | ==Function== | ||
+ | Returns the day of the week of any day after 17 November 2008. | ||
==Sample== | ==Sample== | ||
<b>Today is {{</b><b>THDayofWeek}}</b> returns:<br> | <b>Today is {{</b><b>THDayofWeek}}</b> returns:<br> | ||
− | Today is {{THDayofWeek}} | + | Today is {{THDayofWeek}}<br><br> |
+ | <b>Today is {{</b><b>THDayofWeek|17 April 2009}}</b> returns:<br> | ||
+ | Today is {{THDayofWeek|17 April 2009}} | ||
</noinclude> | </noinclude> |
Revision as of 19:15, 17 November 2008
Variable
Returns the day of the week in the game of today
Function
Returns the day of the week of any day after 17 November 2008.
Sample
Today is {{THDayofWeek}} returns:
Today is Starsday
Today is {{THDayofWeek|17 April 2009}} returns:
Today is Moonday