SuperCiocia
SuperCiocia

Reputation: 1971

Link to previous day in MediaWiki?

I have a university-managed wiki with the basic templated from MediaWiki, but I have been adding more copying them from the Wikipedia templates.
We use it as a lab book so there is a page per day, e.g. 2018/02/02.

I want to write a link to the previous day, i.e. yesterday, 2018/02/01.

I tried:

{{CURRENTYEAR}}/{{CURRENTMONTH}}/{{#expr:{{CURRENTDAY}}-1}} ,

but this returns 2018/02/1.

Upvotes: 1

Views: 117

Answers (1)

Sam Wilson
Sam Wilson

Reputation: 4512

You can use the #time parser function to do some date calculations (anything that's supported by the strtotime() PHP function), for example:

[[{{#time:Y/m/d|now - 1 day}}]]

Or for the day before a particular day:

[[{{#time:Y/m/d|1 April 2017 - 1 day}}]]

Upvotes: 3

Related Questions