RationalWiki:Help/How to make a day counter

From RationalWiki

Jump to: navigation, search

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 321. 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 77. 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).


Help pages for RationalWiki

Help

- RationalWiki -- Blocking -- Comments -- Standards -- Jargon -- Main help page -- Templates -- Bored -- Listing your creations -- Colors -- Image copyright -- Cover story -- Edit summary -- Summary abbreviations -- Editing etiquette -- Navigation -- Copying code -- Image -- Links -- Lists -- Lurking -- Common mistakes -- Namespaces -- Writing a new article -- Titling pages -- Permanent links -- Quotations -- Link colors -- Redirects -- References -- Why register -- Headers and sections -- TOC (table of contents) -- Tables -- Template list -- Toolbar -- Watchlist -- Wikipedia help files -- Wiki language -- Signatures -- Vandalism -- A Newcomers' Guide -- Whitewash (the project) -- Side by side comparison -- Sysop guide -- Userboxen -
Personal tools