Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a given date and I want to add some days to it so that I would like a resulting date in c#.

I tried like this:
C#
DateTime v_expdt = Convert.ToDateTime((TextBox12.Text));

In the textbox12 I have entered say 01/03/2012. I want to add 20days and get the result in the variable v_expdt in dd/mm/yyyy format.

Regards.
Posted
Updated 2-Apr-13 21:41pm
v2

Hey all you need to do is.
C#
v_expdt = v_expdt.AddDays(20).ToShrotDateString();  
 
Share this answer
 
this way...
C#
DateTime v_expdt = Convert.ToDateTime((TextBox12.Text));
string Result = v_expdt.AddDays(20).ToString("dd/MM/yyyy");

Happy Coding!
:)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900