Created
January 17, 2013 13:58
-
-
Save asus4/4556057 to your computer and use it in GitHub Desktop.
月カレンダーのページ単位の期間の差を返します
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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