Help:How to make a day counter

From RationalWiki
Jump to: navigation, search

Note: This is a largely historical article. See Template:Countdown.

Day counters (214 days until the king is dead) can be made using parser functions. It's generally easiest to use the day of the year ({{ #time: z }} in the expressions below; 1 January = 0, 2 January = 1, 3 January = 2, etc.) in the parser function. The parser function also allows you to do calculations with the days of the year (or week of the year or month etc.).

Days since calculation:

Use the following
{{ #expr: ( 32 + {{ #time: z }} ) }}
which gives 205. You will have to adjust the number (in this case 32) to give the correct number of "days since" for the current date

Days until calculation:

Use the following
{{ #expr: ( 366 - {{ #time: z }} ) }}
which gives 193. You will have to adjust the number (in this case 366) to give the correct number of "days until" for the current date.

You will have to update your day counter on the first of the year (or use a more complicated function for the calculation--coming soon).

Personal tools