Given example shows you how to add months to a given Date.
using System.Globalization;
protected void DropEMISchedule_SelectedIndexChanged(object sender, EventArgs e)
{
DateTime dt;
int calcy = Convert.ToInt32(DropEMISchedule.SelectedValue) * Convert.ToInt32(txttenure.Text);
if (DateTime.TryParseExact(txtEMIStartDate.Text, "dd/MM/yyyy",new CultureInfo("en-US"), System.Globalization.DateTimeStyles.None, out dt))
{
TextBoxend.Text = "";
DateTime dtshow = dt.Date.AddMonths(calcy);
TextBoxend.Text = (dtshow).ToString("dd/MM/yyyy");
}
}
using System.Globalization;
protected void DropEMISchedule_SelectedIndexChanged(object sender, EventArgs e)
{
DateTime dt;
int calcy = Convert.ToInt32(DropEMISchedule.SelectedValue) * Convert.ToInt32(txttenure.Text);
if (DateTime.TryParseExact(txtEMIStartDate.Text, "dd/MM/yyyy",new CultureInfo("en-US"), System.Globalization.DateTimeStyles.None, out dt))
{
TextBoxend.Text = "";
DateTime dtshow = dt.Date.AddMonths(calcy);
TextBoxend.Text = (dtshow).ToString("dd/MM/yyyy");
}
}
Its so nice example....
ReplyDelete