How to add days to any date not current dateAbdalla Elawad10yAsked Sep 27, 2016, 10:16 PM EDTSolvedShareLinkedInXCopy linkSaveHi Guys How to add (30)days to any date not current date , if user select any date must be added automatically 30 days ,
How to add days to any date not current dateAbdalla Elawad10yAsked Sep 27, 2016, 10:16 PM EDTSolvedShareLinkedInXCopy linkSaveHi Guys How to add (30)days to any date not current date , if user select any date must be added automatically 30 days ,
Midhun TpRank #388 · 6.5K reputation10y agoPosted Sep 28, 2016, 12:29 AM EDT✓ Accepted answer0Hi,Try like below -string date = TextBox1.Text; DateTime dt1 = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture); TextBox2.Text = dt1.AddDays(30).ToString("dd/MM/yyyy");0
Midhun TpRank #388 · 6.5K reputation10y agoPosted Sep 27, 2016, 10:25 PM EDT0Hi,You can use below code -//First case - format - dd-MMM-yyyy string date = "10-Aug-2016"; date = Convert.ToDateTime(date).AddDays(30).ToString();//Second case - format - mm/dd/yyyystring date = "08/10/2016"; date = Convert.ToDateTime(date).AddDays(30).ToString();0
Abdalla ElawadRank #1,443 · 1.1K reputation10y agoPosted Sep 27, 2016, 11:43 PM EDT0 I have 2 text box as date when insert any date in textbox1 (01/02/20002) must be add 30 days in textbox2 (01/03/2002) (in AutoPostBack) any date inserted not mean current datethank you0
Abdalla ElawadRank #1,443 · 1.1K reputation10y agoPosted Sep 27, 2016, 11:45 PM EDT0like below , but not current date function / any date :TextBox2.Text = TextBox1.Text;DateTime dt = DateTime.Now.AddDays(30);dt.AddDays(-1).ToString("dd/MM/yyyy");TextBox2.Text = dt.ToShortDateString();Label2.BackColor = Color.Green;Label1.Text = ("Team Should Be Changed On:" + dt.AddDays(1).ToShortDateString());0Abdalla ElawadRank #1,443 · 1.1K reputation10y agoPosted Sep 28, 2016, 12:44 AM EDT0Thank u my dearMidhun T P0Lokesh KumarRank #4,352 · 349 reputation10y agoPosted Sep 28, 2016, 12:58 AM EDT0Hi,Please Try this:-DateTime startDate = Convert.ToDateTime(TextBox1.Text);Label1.Text=startDate. AddDays(30).ToString();0Abdalla ElawadRank #1,443 · 1.1K reputation10y agoPosted Sep 28, 2016, 5:01 AM EDT0I f i need to use color display in label when date = 27/MM/2016 Display yellow and 30/MM/2016 Display Red and all days in month display Green how to check date with colorthanks0Midhun TpRank #388 · 6.5K reputation10y agoPosted Sep 28, 2016, 7:57 PM EDT0Hi,You can try like below -string date = TextBox1.Text; DateTime dt1 = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (dt1.Day == 27) Label1.BackColor = Color.Yellow; if (dt1.Day == 30) Label1.BackColor = Color.Red;0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Abdalla ElawadRank #1,443 · 1.1K reputation10y agoPosted Sep 28, 2016, 12:44 AM EDT0Thank u my dearMidhun T P0
Lokesh KumarRank #4,352 · 349 reputation10y agoPosted Sep 28, 2016, 12:58 AM EDT0Hi,Please Try this:-DateTime startDate = Convert.ToDateTime(TextBox1.Text);Label1.Text=startDate. AddDays(30).ToString();0
Abdalla ElawadRank #1,443 · 1.1K reputation10y agoPosted Sep 28, 2016, 5:01 AM EDT0I f i need to use color display in label when date = 27/MM/2016 Display yellow and 30/MM/2016 Display Red and all days in month display Green how to check date with colorthanks0
Midhun TpRank #388 · 6.5K reputation10y agoPosted Sep 28, 2016, 7:57 PM EDT0Hi,You can try like below -string date = TextBox1.Text; DateTime dt1 = DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture); if (dt1.Day == 27) Label1.BackColor = Color.Yellow; if (dt1.Day == 30) Label1.BackColor = Color.Red;0
Midhun TpRank #388 · 6.5K reputationPosted Sep 28, 2016, 12:29 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Sep 27, 2016, 10:25 PM EDT
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Sep 27, 2016, 11:43 PM EDT
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Sep 27, 2016, 11:45 PM EDT
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Sep 28, 2016, 12:44 AM EDT
Midhun T P
Lokesh KumarRank #4,352 · 349 reputationPosted Sep 28, 2016, 12:58 AM EDT
Abdalla ElawadRank #1,443 · 1.1K reputationPosted Sep 28, 2016, 5:01 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Sep 28, 2016, 7:57 PM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts