How to add days to dd/MM/yyyy date format String in TextBox using C#

Last Reply on Jul 21, 2014 01:04 AM By Azim

Posted on Jul 20, 2014 04:52 AM

in textbox18 am have the date as 01/07/2014   i need textbox20 as 02/07/2014  

my code is

 DateTime addonday = Convert.ToDateTime(TextBox18.Text);

      addonday = DateTime.Now.AddDays(1);
      TextBox20.Text = addonday.ToString("dd/MM/yyyy");  

if i put like this 
DateTime.Now.AddDays(1) ( because of now  i got the output as  21/07/2014)

i got the output as 21/07/2014

but my need is 02/07/2014

Posted on Jul 21, 2014 01:04 AM

Refer this code


<asp:TextBox ID="txtDate" runat="server" />
<asp:TextBox ID="txtAddedDate" runat="server" />
<br />
<asp:Button Text="Show 1 Day Added Date" runat="server" OnClick="Show" />


using System.Globalization;


protected void Show(object sender, EventArgs e)
    DateTime dateTime = Convert.ToDateTime(this.txtDate.Text.Trim(), new CultureInfo("en-GB"));
    this.txtAddedDate.Text = dateTime.AddDays(1).ToString("dd/MM/yyyy");