Skip to content

Instantly share code, notes, and snippets.

@asus4
Created January 17, 2013 13:58
Show Gist options
  • Save asus4/4556057 to your computer and use it in GitHub Desktop.
Save asus4/4556057 to your computer and use it in GitHub Desktop.
月カレンダーのページ単位の期間の差を返します
/// <summary>
/// カレンダー単位の期間の差を返します
/// 実際の差ではなくて、2012/12/31と、2013/01/01の差は"1"になります。
/// </summary>
/// <returns>
/// The Month difference.
/// </returns>
public static int CalendarPageDifference (DateTime old, DateTime now)
{
int old_year = old.Year;
int old_month = old.Month;
int now_year = now.Year;
int now_month = now.Month;
return (now_year - old_year) * 12 + (now_month - old_month);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment