Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
public static int DateTimeMonthsSpan(DateTime DateTime1, DateTime DateTime2)
{
int i = 0;
int sign;
DateTime1 = DateTime1.AddDays(1 - DateTime1.Day);
DateTime2 = DateTime2.AddDays(1 - DateTime2.Day);
if (DateTime1 == DateTime2)
return 0;
if (DateTime1.Year > DateTime2.Year)
sign = 1;
else if (DateTime1.Year == DateTime2.Year)
if (DateTime1.Month > DateTime2.Month)
sign = 1;
else
sign = -1;
else
sign = -1;
do
{
i++;
DateTime2 = DateTime2.AddMonths(sign);
}
while(DateTime1 != DateTime2);
return i * sign;
}