System.Globalization.JulianCalendar.CheckDayRange C# (CSharp) Method

CheckDayRange() private method

private CheckDayRange ( int year, int month, int day ) : void
year int
month int
day int
return void
        internal void CheckDayRange(int year, int month, int day) {
            if (year == 1 && month == 1)
            {
                // The mimimum supported Julia date is Julian 0001/01/03.
                if (day < 3) {
                    throw new ArgumentOutOfRangeException(null,
                        Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"));
                }
            }
            bool isLeapYear = (year % 4) == 0;
            int[] days = isLeapYear ? DaysToMonth366 : DaysToMonth365;
            int monthDays = days[month] - days[month - 1];
            if (day < 1 || day > monthDays) {
                throw new ArgumentOutOfRangeException(
                            "day",
                            String.Format(
                                CultureInfo.CurrentCulture,
                                Environment.GetResourceString("ArgumentOutOfRange_Range"),
                                1,
                                monthDays));
            }
        }

Usage Example

Example #1
0
 /// <summary>Determines whether the specified date in the specified era is a leap day.</summary>
 /// <param name="year">An integer that represents the year. </param>
 /// <param name="month">An integer from 1 to 12 that represents the month. </param>
 /// <param name="day">An integer from 1 to 31 that represents the day. </param>
 /// <param name="era">An integer that represents the era. </param>
 /// <returns>
 ///     <see langword="true" /> if the specified day is a leap day; otherwise, <see langword="false" />.</returns>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///         <paramref name="year" /> is outside the range supported by the calendar.-or-
 ///         <paramref name="month" /> is outside the range supported by the calendar.-or-
 ///         <paramref name="day" /> is outside the range supported by the calendar. -or-
 ///         <paramref name="era" /> is outside the range supported by the calendar. </exception>
 // Token: 0x06002F55 RID: 12117 RVA: 0x000B55E2 File Offset: 0x000B37E2
 public override bool IsLeapDay(int year, int month, int day, int era)
 {
     JulianCalendar.CheckMonthRange(month);
     if (this.IsLeapYear(year, era))
     {
         JulianCalendar.CheckDayRange(year, month, day);
         return(month == 2 && day == 29);
     }
     JulianCalendar.CheckDayRange(year, month, day);
     return(false);
 }
All Usage Examples Of System.Globalization.JulianCalendar::CheckDayRange