Saturday 2016-03-26

Here's some stupid tricks that make you look smart:

// https://www.programmingalgorithms.com/algorithm/day-of-week
public enum DayOfWeek
{
	Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
}

public static DayOfWeek GetDayOfWeek(uint year, byte month, byte day)
{
	byte[] monthTable = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 };

	year -= (uint)((month < 3) ? 1 : 0);

	return (DayOfWeek)((year + year / 4 - year / 100 + year / 400 + monthTable[month - 1] + day) % 7);
}