Template:Weekday in month

The template then gives j, the day of the month, as calculated by the following formulae.


 * j = 7×n − 6 + (w − w1) mod 7 (for positive n)


 * j = t + 7×(n + 1) − (wt − w) mod 7 (for negative n)

Where t is the last day of the month, wt is the ISO weekday number of the last day of the month, w1 is the ISO weekday number of the first day of the month and n and w are as defined above.