SDU Tools are free tools and example T-SQL code for SQL Server developers and DBAs. DatesInPeriod is a table-valued function that returns dates that fall in a particular period. You supply a start date, a type of increment (DAY, WEEK, MONTH, QUARTER, YEAR) and a number of increments, and it returns all that dates in that period.
To join SDU Insiders and get all our free resources, including SDU Tools, see the details at http://sdutools.sqldownunder.com