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)


Manesh GolekarRank #5,709 · 289 reputationPosted Jul 20, 2014, 10:28 PM EDT
Try this code
TextBox20.Text = (DateTime.Parse(TextBox18.Text).AddDays(1)).ToShortDateString();
selvi subramanianRank #2,007 · 723 reputationPosted Jul 21, 2014, 12:04 AM EDT
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 GolekarRank #5,709 · 289 reputationPosted Jul 21, 2014, 12:12 AM EDT
selvi subramanianRank #2,007 · 723 reputationPosted Jul 21, 2014, 12:25 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jul 21, 2014, 1:37 AM EDT
If it's 07/01/2014 then try replacing en-GB with en-US.
selvi subramanianRank #2,007 · 723 reputationPosted Jul 23, 2014, 3:21 AM EDT
DateTime dateTime = Convert.ToDateTime(this.TextBox18.Text.Trim(), new CultureInfo("en-GB"));
this.TextBox20.Text = dateTime.AddDays(1).ToString("dd/MM/yyyy");