|
-
October 28th, 2009, 03:07 PM
#3
Re: Zeller's Congruence
 Originally Posted by BobS0327
Looks like the problem is ((m+1)26). Possibly need a arithmetic operator between the right paren and 26???
Code:
h = ( q + floor( ((m+1)26) / 10 ) + y + floor(y/4) + 6 * floor(y/100) + floor(y/400)) % 7;
All the variables are already ints so using the floor() function is redundant. You also might want to look into putting some error guards in against invalid dates like February 29 in a non-leap year, or September 31.
Out of curiosity...what is the reason behind the non-standard numeric assignment of the weekdays and months?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|