Datevid Letterman's stupid date trick...
In a current project (Today is June 9, 2004), a colleague of mine had
to figure out which date a specific day was in a particular month. His
particular problem went along the lines of: "If the third Sunday
of March is a particular date do something, else do something else."
We went for a walk to take a break from a long day of non stop coding,
and once he mentioned the little problem, I couldn't get it out of my
He had already solved the problem doing some fancy counting, and since
there are many ways to skin a cat, I thought of a general solution to
solve the type of question "What date does the <first | second
| ...> <Mon | Tues | ...> of <Jan | Feb | ...> of <any
year> fall under?" - An example: What date does the second Sunday
of May of 2004 fall under? (That's mother's day in North America).
So, if you ever wondered what date it was on the third Wednesday of
July, 1972, wonder no more. Here it is, Datevid Letterman's stupid date
The source code is here.
Note: The code had an error while moving to the selected day, hence the
returned date was wrong in some cases. Our, now, friend ZhiXing
Bhikkhu stumbled upon this page and found the bug.