Information icon.svg At All things in moderation, we are currently voting on restrictions on the use of LLMs (chatbots) in RationalWiki. Reminder: you need to have at least 75 edits and to have been registered for at least three months to be eligible to vote.

Help:How to make a day counter

From RationalWiki
Jump to navigation Jump to 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 295. 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 103. 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).