Possible Duplicate:
c#: whats the easiest way to subtract time?
I have a table containing a field of dates and some other field (not important to mention), and I need two reports:
1.based on month
2.based on week
I have done the report number 1
my question is HOW CAN I ACHIEVE report 2, I need something that gives me this:
let’s say we have dates from 2001/01/01 to 2001/01/31
I want to get all days grouped by week for example if 2001/01/01 is Sunday i want groups like:
1st week : 2001/01/01 – 2001/01/02 – … – 2001/01/07
2nd week : 2001/01/08 – … – 2001/01/14
3rd week : 2001/01/15 – … – 2001/01/21
4th week : 2001/01/22 – … – 2001/01/28
5th week : 2001/01/29 – 2001/01/30 – 2001/01/31
If you pass negative number in AddDays method it will subtract that number of days from date object.
or