Setting A particular Day in a date

ajax, asp.net, c#

Solution

You can set whatever day of month by add month.

DateTime todayDate = DateTime.Now;
DateTime after3MonthDate = todayDate.AddMonths(3);
//Set First Day of Month
after3MonthDate = new DateTime(after3MonthDate.Year, after3MonthDate.Month, 1);

Problem

I am using Calender Extender Control in the AjaxControlToolkit. There are basically 2 controls of date : `Start Date` and `End date` (both associated with calender extender). Based on start Date selected, I populate date in the end date field like adding no of months or days. But like I have been able to add months, but also wants to set a particular day of that month which I am unable to do. Example: Today date is `18 Dec 2012`. Something like 1st of every three months, So I add 3 months the month comes out to be `Feb 2013`. But I want to set Day `1st Feb 2013`. I am unable to do it. Kindly help.

Original source