I'm trying to calculate the due date of an invoice, and I have a date of invoice, days to due date (100) and I need to calculate due date with whole months:
if date of invoice = 07/05/2009 and days of due date = 120, then the due date calculated = 07/09/2009 (4 months exactly -whole months-).
numberOfMonths = numberOfDays % 30;
dueDate = dt.AddMonths(numberOfMonths);
restOfNumberOfDays = numberOfDays - (numberOfMonths * 30);
dueDate = dueDate.AddDays(restOfNumberOfDays);
This code would be correct if the month had 30 days long.