+ 1

# How to find day of any date in c++ prigramming?

can someone tell me, please....

1 Answer

0

int dayname(int day, int month, int year)
{
Â Â Â Â static int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };
Â Â Â Â year -= month < 3;
Â Â Â Â return ( year + year/4 - year/100 + year/400 + t[month-1] + day) % 7;
}
//Sunday is 0, Monday is 1 ...
/*http://stackoverflow.com/questions/6385190/correctness-of-sakamotos-algorithm-to-find-the-day-of-week/6385934#6385934*/