Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose i have a starting date say 2004-01-01 and i want to get after 30 days from the start date ie 2004-01-30.
How can i get that?
Posted

1 solution

Use the AddDays method of the DateTime object:

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

C#
var startDate = DateTime.Now;

var endDate = startDate.AddDays(30);


Hope it helps.
 
Share this answer
 
Comments
sahabiswarup 8-Nov-12 7:04am    
Thanks Jim
jim lahey 8-Nov-12 7:06am    
My pleasure, glad to be of assistance.

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