I find that one of the most useful tables to have is a great big lookup-table, primary-keyed by date, with every date for about 200 years listed in it. ("Dig me up and I'll fix it then.") You can enter, for each date, every possible thing you could want to know about that date... including for example, "what's the date of 'the first of next month?'"
The difficult date-calculations become something that's quite easy to describe and easy for the DBMS to handle... a simple join.
I've used this trick with DBMSes of all descriptons; sometimes out of necessity (because they were dumb-as-toast about dates or because it took too long), but mainly because it's a simple and elegant way to get a lot of things done.
thanks! but wouldn't it be easier to create a function rather than a table containing dates for 200 years? What i need to do exactly is to be able to select entries from tables by week of month, although the weeks should be made so that the first week of the month is that which contains the first monday of the month.