如何计算Day of the Week
learn.whatIsHeading
A day-of-week calculator determines what day of the week any given date falls on. The Doomsday algorithm (Conway) or modular arithmetic can compute this for any date in the Gregorian calendar.
分步指南
- 1Use the formula: (d + m + y + y/4 − y/100 + y/400 + c) mod 7
- 2d=day, m=month code, y=year, c=century adjustment
- 3Or simply count forward/backward from a known reference date
- 4JavaScript: new Date("YYYY-MM-DD").getDay() → 0=Sunday, 6=Saturday
例题解析
输入
July 4, 1776
结果
Thursday
US Independence Day
输入
January 1, 2000
结果
Saturday
Y2K millennium
准备好计算了吗?尝试免费的 Day of the Week 计算器
自己尝试一下 →