using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cmoss.Util
{
public class DateFunctions
{
///
/// Gets the months between.
///
/// The first.
/// The last.
/// if set to true [inclusive].
///
public static int GetMonthsBetween(DateTime first, DateTime last, bool inclusive)
{
int result = GetDaysBetween(first, last, true) / 30;
return inclusive ? result + 1 : result;
}
///
/// Gets the days between.
///
/// The first.
/// The last.
/// if set to true [inclusive].
///
public static int GetDaysBetween(DateTime first, DateTime last, bool inclusive)
{
TimeSpan span = last - first;
return inclusive ? span.Days + 1 : span.Days;
}
}
}