Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Kumppi

Which weekday is it?

This topic is 5403 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am creating a boxing manager game and I need to keep a calender which works like the real gregorian calender. I have a class cDate that holds the current day, month and year and I can manipulate the date which the cDate object holds and it makes sure that the date stays valid. Now the problems is this. Let''s say that the cDate object holds the date 20th of january 1978 and I now want to know what weekday it is. Are there any algorithms for calculating the weekday or perhaps you could give me some hints how I should go making one. "Life is very short, and there''s no time for fussing and fighting my friend..."

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Couldn''t you just store the week day of the first day of play, or some irrelevent date some number of days back in time and then calculate the number of days it''s been since then, divide by seven, subtract the integral number, and multiply by seven to get the number of days after that specific weekday? The only problem would be making the algorithm support leap years, I think. But that shouldn''t be too hard.

Share this post


Link to post
Share on other sites
Yes that would be one solution, but I found another one at http://5dspace-time.org/Calendar/Algorithm.html


"Life is very short, and there''s no time for fussing and fighting my friend..."

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!