Difference between revisions of "Template:THDayofWeek"

From Twilight Heroes Wiki
Jump to: navigation, search
m (Added for EVALUATION statement)
m (fixed for gained day)
 
(4 intermediate revisions by 3 users not shown)
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>{{#if:{{{1}}} <!-- for an EVALUATION statement, if argument exists -->
+
<!-- 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. This is adjusted for the two days lost in July 2009, one day lost in June 2013, and one day gained in March 2014--><includeonly>{{#ifeq:{{{1|?}}}|? <!-- checks for an EVALUATION statement, if argument exists -->
 
|{{#switch: <!-- SWITCH for determining name of day -->
 
|{{#switch: <!-- SWITCH for determining name of day -->
 
   {{#expr:
 
   {{#expr:
 
     (
 
     (
       {{#time: j | {{{1}}}}}
+
       {{CURRENTDAY}}
       + {{#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}}
+
       + {{#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}}
       + ({{#time: Y | {{{1}}}}} - 2004) * 365
+
       + ({{CURRENTYEAR}} - 2004) * 365
       + ((({{#time: Y | {{{1}}}}} - 2006) / 4) round 0)
+
       + ((({{CURRENTYEAR}} - 2006) / 4) round 0)
       - (({{#time: Y | {{{1}}}}} mod 4 = 0) and (({{#time: n | {{{1}}}}} = 01) or ({{#time: n | {{{1}}}}} = 02)))
+
       - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
 
       - 1776 <!-- Day number for the 16th November 2008 using this formula -->
 
       - 1776 <!-- Day number for the 16th November 2008 using this formula -->
 +
      + (({{#time: H}} >= 4) and ({{#time: i}} >= 10) or ({{#time: H}} >= 5))
 +
      + 3 <!-- For the two days lost in July 2009 and one in June 2013 -->
 +
      - 1 <!-- For the day lost in March 2014 -->
 
     ) mod 6}}
 
     ) mod 6}}
 
   |0=Sunday
 
   |0=Sunday
Line 20: Line 23:
 
   {{#expr:
 
   {{#expr:
 
     (
 
     (
       {{CURRENTDAY}}
+
       {{#time: j | {{{1}}}}}
       + {{#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:{{#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}}
       + ({{CURRENTYEAR}} - 2004) * 365
+
       + ({{#time: Y | {{{1}}}}} - 2004) * 365
       + ((({{CURRENTYEAR}} - 2006) / 4) round 0)
+
       + ((({{#time: Y | {{{1}}}}} - 2006) / 4) round 0)
       - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
+
       - (({{#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 -->
 
       - 1776 <!-- Day number for the 16th November 2008 using this formula -->
      + (({{#time: H}} >= 4) and ({{#time: i}} >= 10) or ({{#time: H}} >= 5))
 
 
     ) mod 6}}
 
     ) mod 6}}
 
   |0=Sunday
 
   |0=Sunday
Line 39: Line 41:
  
 
==Function==
 
==Function==
Returns the day of the week of any day after 17 November 2008.
+
Returns the day of the week of any day after 30 March 2014.
  
 
==Sample==
 
==Sample==
<b>Today is {{</b><b>THDayofWeek}}</b> returns:<br>
+
<b><nowiki>Today is {{THDayofWeek}}</nowiki></b> returns:<br>
 
Today is {{THDayofWeek}}<br><br>
 
Today is {{THDayofWeek}}<br><br>
<b>Today is {{</b><b>THDayofWeek|17 April 2009}}</b> returns:<br>
+
<b><nowiki>17 July 2009 is {{THDayofWeek|17 July 2009}}</nowiki></b> returns:<br>
Today is {{THDayofWeek|17 April 2009}}
+
17 July 2009 is {{THDayofWeek|17 July 2009}}
</noinclude>
+
[[Category:Utility Templates|{{PAGENAME}}]]</noinclude>

Latest revision as of 17:00, 30 March 2014

Variable

Returns the day of the week in the game of today

Function

Returns the day of the week of any day after 30 March 2014.

Sample

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

17 July 2009 is {{THDayofWeek|17 July 2009}} returns:
17 July 2009 is Thewsday