Determining a DateTime by adding a number of Days to a Date - Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a loop where I need to calculate a series of dates based on:
1) a start date (DateTime variable)
2) a number of days (integer variable)

I need to take the start date, then add the number of days to it, and come
up with the next date.

eg.
- DateTime variable might equal 01/02/2005
- My integer for "Number of Days" is 10
- I need to take my DateTime variable (01/02/2005) and add the integer 10
(for 10 days) to it. This should produce the result of 01/12/2005 as a
DateTime variable.

Any ideas on how to go about this?
 
Try this.

DateTime origDate = DateTime.Now;
DateTime result = origDate.AddDays(10);
 
Back
Top