Sign in | Join
Last post 05-16-2008 12:42 PM by avmood. 3 replies.
Sort Posts: Oldest to newest Newest to oldest
For example,
2008/01/01 and 2008/05/01 = 4
2008/01/02 and 2008/05/01 = 3
I got it.
now and past are DateTime varaiables.
int monthsApart = 12 * (now.Year - Past.Year) + now.Month - Past.Month;
{
monthsApart--;
}
You could use timespan
Timespan ts = Date1 - Date2
convert the result to months.
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.