DateTime range

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hi

I am trying to get a date range in c#.
I can get the one range by date1 = DateTime.Now();

But if I wanted to go back say 5 days how do I go about calculating the date
for that.

I was looking for a DateTime function that would convert the date into an
integer and then convert it back but without luck.

Any suggestions would be appreciated

Thanks in advance

Bill
 
Use the AddDays method.

DateTime date1 = DateTime.Now;
DateTime date2 = date1.AddDays(-5);
 
Back
Top