Simple Zeller's congruence to get day of week - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Utilities (https://qb64phoenix.com/forum/forumdisplay.php?fid=8) +---- Thread: Simple Zeller's congruence to get day of week (/showthread.php?tid=3034) Pages:
1
2
|
RE: Simple Zeller's congruence to get day of week - TDarcos - 09-16-2024 (09-16-2024, 12:16 PM)SMcNeill Wrote:You're doing an apples vs. oranges comparison. I'm not comparing the time, time value does not matter, because either the date changed, or it didn't. And what I wrote works either way The concept that the date and time changes after the comparison test, does not matter. There are only two possible states: Date changed between the retrieval of the date and the comparison, or date did not change. In almost every case, the "did not change" will be the default state. Which means the date did not change from the time the first request is made and the comparison. Since the time is requested after the first date request, the date and time are in sync. So it does not matter that the time or date changed after the test, because the date and time are in sync at that instant. If the change of dates during the comparison did happen, midnight has occurred, it cannot happen again for 24 hours, so the date and time of the second request will be in sync. There is another method to do this, I had forgotten I wrote on 3/16: Code: (Select All)
In this case, it's exactly the same. We look at the hour. If it is not 0, it is physically impossible for the time to have changed after the date was collected. If the hour is 0, we don't know if the time changed after the first date collected, we take the second date because, since midnight has already transpired, again, it's physically impossible for midnight to occur again for 23 hours. I mean, is it strictly necessary to do this, no, but failing to protect against failures is what causes a lot of damage. I prefer to avoid the pain. RE: Simple Zeller's congruence to get day of week - TDarcos - 09-17-2024 I have edited the first post of this thread to warn people reading the material later that the formula I'm using for Zeller's congruence has some error in it. Beyond that, I made no other changes. As I point out in the warning, I take responsibility for my actions, whether the formula was wrong or I copied it wrong, is irrelevant. It also means you don't hide your mistakes, you learn from them. RE: Simple Zeller's congruence to get day of week - TDarcos - 09-17-2024 And if you want to know what I'm doing about this saga, check out this posting, More Problems with (implementations of) Zeller's congruence. |