Template talk:WEEKDAYNUMBER

Latest comment: 18 years ago by CBDunkerson in topic Error

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)












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