There's a very quick way to figure out the day of the week for a given date (dd/mm/yyyy) using Zeller's Congruence[0]. By figuring out the day of the week for the first of the month and knowing how many days in the month (with an allowance for leap years), it's easy to then calculate the number of Thursdays.