- #1
magnifik
- 360
- 0
i am trying to find when the first day of the week is for a given year and month. this formula gives the day of the first day of the year:
(([y-1]*365+[y-1]/4-[y-1]/100+[y-1]/400)+1)%7
if it equals 0, it starts on sunday. 1 means monday, 2 means tuesday, and so on ending with 6 for saturday. the problem is i am trying to figure out how this formula can help me find the beginning of all the months, not just january. any help would be appreciated.
(([y-1]*365+[y-1]/4-[y-1]/100+[y-1]/400)+1)%7
if it equals 0, it starts on sunday. 1 means monday, 2 means tuesday, and so on ending with 6 for saturday. the problem is i am trying to figure out how this formula can help me find the beginning of all the months, not just january. any help would be appreciated.