For variation, here is method that doesn't require the Calendar
package and uses a function which returns days of the week ranging from 0 for Sunday to 6 for Saturday:
GaussDay[y_Integer, m_Integer, d_Integer] :=
With[{yDigits = IntegerDigits[y - Boole[m < 3]},
With[{ y1 = FromDigits[yDigits[[1 ;; 2]]],
y2 = FromDigits[yDigits[[3 ;; 4]]]},
Mod[(d + Floor[2.6 ( Mod[m + 9, 12] + 1) - 0.2] + y2 +
Quotient[y2, 4] + Quotient[y1, 4] - 2 y1), 7]]]
And in play:
Select[WeatherData["Chicago",
"Temperature", {{2011, 1, 1}, {2011, 12, 11}}],
MemberQ[Range@5, GaussDay @@ #[[1, 1 ;; 3]]] &]
For comparison, this took about 8.5 seconds to select approx 130,000 measurements when asked for 83 years of data.
DayOfWeek
in the documentation. $\endgroup$ – b.gates.you.know.what Jun 12 '12 at 13:28