0
Plz explain this. " firstDay = (2 + numDays) % 7; firstDay;"
to get the first day of the month
5 Respostas
+ 1
Is it calculating what the day of the week will be? Because if so that won't work as that depends on the year. and if it is what date the first of the month is the. this is pointless because it is always 1. So I'm a little confused exactly what this is trying to do.
0
yes someone used to calculate the first day of the month
0
plz can u explain just the working this only statement
0
int FirstDayOfMonth(int year,int month) { int t[12] = {0,3,2,5,0,3,5,1,4,6,2,4}; int y = year - (month < 2); y=(y + y/4 - y/100 + y/400 + t[month]+1) % 7; // y = 0 for Sunday, 1 for Monday.. etc. return y; }
and how this is working
0
This is probably the best explanation of this algorithm. Sorry it took me a while to find it again.
https://www.quora.com/How-does-Tomohiko-Sakamotos-Algorithm-work