Difference between revisions of "Template:THDayofWeek"

From Twilight Heroes Wiki
Jump to: navigation, search
(Created)
 
(Changed starting calculation date; added description and comments, formatted.)
Line 1: Line 1:
<includeonly>Today is: {{#switch:
+
<!-- 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 -->
 
   {{#expr: ({{CURRENTDAY}}
 
   {{#expr: ({{CURRENTDAY}}
 
     + {{#switch:{{CURRENTMONTH}}|01=0|02=31|03=59|04=90|05=120|06=151|07=181|08=212|09=243|10=273|11=304|12=334}}
 
     + {{#switch:{{CURRENTMONTH}}|01=0|02=31|03=59|04=90|05=120|06=151|07=181|08=212|09=243|10=273|11=304|12=334}}
     + ({{CURRENTYEAR}} - 2000) * 365
+
     + ({{CURRENTYEAR}} - 2004) * 365
     + ((({{CURRENTYEAR}} - 2002) / 4) round 0) - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
+
     + ((({{CURRENTYEAR}} - 2006) / 4) round 0) - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
     - 3237
+
     - 1776 <!-- Day number for the 16th November 2008 using this formula -->
 
     + (({{#time: H}} <= 4) and ({{#time: i}} <= 10))) mod 6}}
 
     + (({{#time: H}} <= 4) and ({{#time: i}} <= 10))) mod 6}}
 
   |0=Sunday
 
   |0=Sunday
Line 16: Line 17:
 
==Variable==
 
==Variable==
 
Returns the day of the week in the game of today
 
Returns the day of the week in the game of today
 +
 +
==Sample==
 +
<nowiki>Today is {{THDayofWeek}} returns:</nowiki><br>
 +
Today is {{THDayofWeek}}
 
</noinclude>
 
</noinclude>

Revision as of 19:31, 15 November 2008


Variable

Returns the day of the week in the game of today

Sample

Today is {{THDayofWeek}} returns:
Today is Thewsday