Exemple #1
0
 /// <summary>
 /// Days in current month after given date.
 /// </summary>
 /// <returns>Number of days.</returns>
 /// <param name="fromDate">From date.</param>
 private static int DaysBeforeWholeMonths(Date fromDate)
 {
     if (IsLeapMonth(fromDate.Year, fromDate.Month))
     {
         return(DaysMap.MapMonthDays(fromDate.Month) + 1 - fromDate.Day);
     }
     else
     {
         return(DaysMap.MapMonthDays(fromDate.Month) - fromDate.Day);
     }
 }
Exemple #2
0
        /// <summary>
        /// Days in a range of months.
        /// </summary>
        /// <returns>Number of days.</returns>
        /// <param name="year">Year.</param>
        /// <param name="fromMonth">From month.</param>
        /// <param name="toMonth">To month.</param>
        private static int DaysInWholeMonths(short year, short fromMonth, short toMonth)
        {
            if (toMonth - fromMonth < 0)
            {
                return(0);
            }
            int totalDays = 0;

            for (short i = fromMonth; i <= toMonth; i++)
            {
                if (IsLeapMonth(year, i))
                {
                    totalDays++;
                }
                totalDays += DaysMap.MapMonthDays(i);
            }

            return(totalDays);
        }