37
I like V4V's answer, but I write it this way:
DateTime dt = new DateTime(2011,12,2);
DateTime firstDayNextMonth = dt.AddMonths(1).AddDays(-dt.Day+1);
For example, I might be computing a future time and this code does that without stripping out the time part.
Per hvd's most astute comment, this code should be:
DateTime dt = new DateTime(2011,12,2);
DateTime firstDayNextMonth = dt.AddDays(-dt.Day+1).AddMonths(1);
If you call AddMonths(1) then .NET will automatically roll the date into the next year.
periodStartDate.AddMonths(1).Month;