Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Template talk:WEEKDAYNUMBER

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia

Calculates X mod 7 for reasonable values of X.

Intended primarily for weekday calculations.

5 mod 7 = 5

8 mod 7 = 1

11 mod 7 = 4

14 mod 7 = 0

-2 mod 7 = 5

Self test

[edit]

(blank if no problems)

0 mod 7 = 7? (should be 0)
0.5 mod 7 = 7? (should be 0)
14 mod 7 = 7? (should be 0)
-13.1 mod 7 = 7? (should be 0)

Error

[edit]

This template does not handle the '12 hour gap' on Julian dates. It treats 00:00:01 through 11:59:59 of Thursday as still being Wednesday.

It is currently Julian date 2453866.91806... 10:03 UTC Thursday, May 11 2006. However, this template evaluates {{WEEKDAYNUMBER|2453866.91806}} to 2 (2 at time of writing)... which is Wednesday. Julian days roll over at noon, but weekday names roll over at midnight. Thus, to calculate the weekday name (or number) from a Julian date you need to add 0.5 (12 hours) to the Julian date value. Currently everything from 2453866.5 to 2453866.999999 is incorrectly treated as being Wednesday rather than Thursday. Presumably the +/- 6.5 logic in the template is somehow meant to deal with this in conjunction with the possibility of negative values... but it isn't working. --CBDunkerson 10:10, 11 May 2006 (UTC)Reply

 You are invited to join the discussion at Wikipedia talk:WikiProject Time § Weekday templates that claim to follow ISO weekday number, but don't. Peterwhy (talk) 05:39, 28 December 2025 (UTC)Reply