1/07/2014
here 07 is month
01 is date
my code is
textbox18 is date retrieved from database in database the date is saved like dd/MM/yyyy format.
1 2 3 | DateTime addonday = Convert.ToDateTime(TextBox18.Text); addonday = addonday.AddDays(1); TextBox20.Text = addonday.ToString("dd/MM/yyyy"); |
my output is like this
08/01/2014 (1 is add with month ) my need is that 1 is add with the date
01/07/2014 (1 is date 7 is month ) my need is (02/07/201)
but output cum like this (08/01/2014)

selvi subramanianPosted Jul 23, 2014, 7:21 AM
DateTime dateTime = Convert.ToDateTime(this.TextBox18.Text.Trim(), new CultureInfo("en-GB"));
this.TextBox20.Text = dateTime.AddDays(1).ToString("dd/MM/yyyy");
VulpesPosted Jul 21, 2014, 5:37 AM
If it's 07/01/2014 then try replacing en-GB with en-US.
selvi subramanianPosted Jul 21, 2014, 4:25 AM
Manesh GolekarPosted Jul 21, 2014, 4:12 AM
selvi subramanianPosted Jul 21, 2014, 4:04 AM
my code is
DataSet dssf = new DataSet();
string qws = "select max(date) as lastdate from aten where id='" + rtid.Text + "' and Status='" + TextBox19.Text; qws += "'";
dssf = mvl.GETDS(qws);
foreach (DataRow dr in dssf.Tables[0].Rows)
{
TextBox18.Text = dr["lastdate"].ToString();
DateTime dateTime = Convert.ToDateTime(this.TextBox18.Text.Trim(), new CultureInfo("en-GB"));
this.TextBox20.Text = dateTime.AddDays(1).ToString("dd/MM/yyyy");
}
Manesh GolekarPosted Jul 21, 2014, 2:28 AM
Try this code
TextBox20.Text = (DateTime.Parse(TextBox18.Text).AddDays(1)).ToShortDateString();