• Support PF! Buy your school textbooks, materials and every day products Here!

Help on the doomsday equation/birthday equation

here's the equation


d = date of the month
m = number of the month in the year
y = year


W = d + 2m + [3(m+1)/5] + y + [y/4] - [y/100] + [y/400] + 2

afterwards, divide w by 7, and the remainder is the day of the week, according to:

1 - sunday
2 - monday
3 - tuesday
4 - wednesday
5 - thursday
6 - friday
0 - saturday


now, i totally understand the equation, and it works. but i just dont understand what the significance of the [y/4] [y/100] and [y/400] is.
why is it needed in the equation? :frown:
 

Answers and Replies

arildno
Science Advisor
Homework Helper
Gold Member
Dearly Missed
9,946
130
Take them out. Does the formula work then?
 
no, the formula is off. when i tried it with today's date without them, it turned out 1 day behind.
 
HallsofIvy
Science Advisor
Homework Helper
41,738
897
Think about leap years.
 
27
0
I tried this equation for Monday, January 29 and it did not work. It also did not work for Tuesday, January 30 or Monday, January 01. It always comes up one day behind. Does it stop working at some year?
 
HallsofIvy
Science Advisor
Homework Helper
41,738
897
Think about leap years!
 

Related Threads for: Help on the doomsday equation/birthday equation

  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
9
Views
892
  • Last Post
Replies
2
Views
817
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
1
Views
7K
Replies
3
Views
348
Top