Click here to Skip to main content
16,013,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to add day in a given that butpbm is date is given dd/mm/yyyy formate.so i am unable to add day in date. please help me fast
Posted
Updated 24-Sep-12 1:24am
v2

Hi,

See the below links. It might be help you to find your answer.

http://www.dotnetperls.com/datetime[^]
http://msdn.microsoft.com/en-us/library/system.datetime.adddays.aspx[^]

Thanks,
Viprat
 
Share this answer
 
Try this:
C#
string input = "24/09/2012";
DateTime dateTime;
if (DateTime.TryParse(input, out dateTime))
{
    DateTime dt = dateTime.AddDays(1);
    //This will add a day to your date
}



--Amit
 
Share this answer
 
v3
Comments
Deepak_Shukla 24-Sep-12 7:38am    
thanks but problem is in the place of any date we use a TextBox and we set the format of date dd/mm/yyyy with the help of ajax calender extendor and then we add some days in event of textBox and display it in another textbox.so it genrate an error

String was not recognized as a valid DateTime
thanks
_Amy 24-Sep-12 7:40am    
Use DateTime.TryParse[^] to check it.
Use my updated answer.
Deepak_Shukla 24-Sep-12 9:12am    
thanks
it works!
_Amy 24-Sep-12 10:07am    
Welcome. :)
Hi,

try like this,

C#
DateTime Current = Convert.ToDateTime("10/12/2012");
DateTime newDate = Current.AddDays(1);


hope it helps.
 
Share this answer
 

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