Template:THDayofWeek: Difference between revisions

From Twilight Heroes Wiki
Jump to navigation Jump to search
m fixing linebreak issue
Dfmchfhf (talk | contribs)
Fixed the the-day-is-wrong-if-the-minutes-in-the-hour-is-before-10 problem.
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. -->
   {{#expr: ({{CURRENTDAY}}
<includeonly>{{#switch: <!-- SWITCH for determining name of day -->
    + {{#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}}
   {{#expr:
    + ({{CURRENTYEAR}} - 2004) * 365
    (
    + ((({{CURRENTYEAR}} - 2006) / 4) round 0) - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
      {{CURRENTDAY}}
    - 1776 <!-- Day number for the 16th November 2008 using this formula -->
      + {{#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: H}} >= 4) and ({{#time: i}} >= 10))) mod 6}}
      + ({{CURRENTYEAR}} - 2004) * 365
      + ((({{CURRENTYEAR}} - 2006) / 4) round 0)
      - (({{CURRENTYEAR}} mod 4 = 0) and (({{CURRENTMONTH}} = 01) or ({{CURRENTMONTH}} = 02)))
      - 1776 <!-- Day number for the 16th November 2008 using this formula -->
      + (({{#time: H}} >= 4) and ({{#time: i}} >= 10) or ({{#time: H}} >= 5))
    ) mod 6}}
   |0=Sunday
   |0=Sunday
   |1=Moonday
   |1=Moonday

Revision as of 19:12, 16 November 2008


Variable

Returns the day of the week in the game of today

Sample

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