For example,
2008/01/01 and 2008/05/01 = 4
2008/01/02 and 2008/05/01 = 3
![]() |
2 |
![]() |
I got it.
now and past are DateTime varaiables.
int monthsApart = 12 * (now.Year - Past.Year) + now.Month - Past.Month;
if (now.Day < Past.Day){
monthsApart--;
}
![]() |
0 |
![]() |
You could use timespan
Timespan ts = Date1 - Date2
convert the result to months.
Dorm Mom LLC: College Laundry Services | Grocery Delivery | Apartment Cleaning
![]() |
0 |
![]() |
Using Timespan, the end result will be in days, not in months, and I cannot just divide it by 30 to assume that each month is 30 days.
![]() |
0 |
![]() |