Hi I’m wondering how can you determine the day of the week of a date
based on month, day, or year? Without using the Date class because I am
trying to do a little program without it. I do have some numbers
constants at the top of my file. For example
SUNDAY = 0
MONDAY = 1
…
WEDNESDAY = 3
etc…
Hi I’m wondering how can you determine the day of the week of a date
based on month, day, or year? Without using the Date class because I am
trying to do a little program without it.
So, in other words, you try to re-program the calendar that is available
via the Date-class.
You need to make the same concessions as the inventors of any such thing
(calendar) and determine a starting point. From then on, and given that
the leap year problem had been solved before, you need the numbers
between 1 and 7 to calculate a day. Addition and subtraction come handy.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.