CheckYearMonthRange() private method

private CheckYearMonthRange ( int year, int month, int era ) : void
year int
month int
era int
return void
コード例 #1
0
 /// <summary>Calculates the number of days in the specified month of the specified year and era.</summary>
 /// <param name="year">A year. </param>
 /// <param name="month">An integer from 1 through 12 that represents a month. </param>
 /// <param name="era">An era. Specify <see langword="UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra]" /> or <see cref="F:System.Globalization.UmAlQuraCalendar.UmAlQuraEra" />.</param>
 /// <returns>The number of days in the specified month in the specified year and era. The return value is 29 in a common year and 30 in a leap year.</returns>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///         <paramref name="year" />, <paramref name="month" />, or <paramref name="era" /> is outside the range supported by the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class. </exception>
 // Token: 0x06002EDD RID: 11997 RVA: 0x000B3F56 File Offset: 0x000B2156
 public override int GetDaysInMonth(int year, int month, int era)
 {
     UmAlQuraCalendar.CheckYearMonthRange(year, month, era);
     if ((UmAlQuraCalendar.HijriYearInfo[year - 1318].HijriMonthsLengthFlags & 1 << month - 1) == 0)
     {
         return(29);
     }
     return(30);
 }
コード例 #2
0
        /// <summary>Determines whether the specified date is a leap day.</summary>
        /// <param name="year">A year. </param>
        /// <param name="month">An integer from 1 through 12 that represents a month. </param>
        /// <param name="day">An integer from 1 through 30 that represents a day. </param>
        /// <param name="era">An era. Specify <see langword="UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra]" /> or <see cref="F:System.Globalization.UmAlQuraCalendar.UmAlQuraEra" />.</param>
        /// <returns>
        ///     <see langword="true" /> if the specified day is a leap day; otherwise, <see langword="false" />. The return value is always <see langword="false" /> because the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class does not support leap days.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///         <paramref name="year" />, <paramref name="month" />, <paramref name="day" />, or <paramref name="era" /> is outside the range supported by the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class. </exception>
        // Token: 0x06002EE5 RID: 12005 RVA: 0x000B4014 File Offset: 0x000B2214
        public override bool IsLeapDay(int year, int month, int day, int era)
        {
            if (day >= 1 && day <= 29)
            {
                UmAlQuraCalendar.CheckYearMonthRange(year, month, era);
                return(false);
            }
            int daysInMonth = this.GetDaysInMonth(year, month, era);

            if (day < 1 || day > daysInMonth)
            {
                throw new ArgumentOutOfRangeException("day", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Day"), daysInMonth, month));
            }
            return(false);
        }
コード例 #3
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is set to the specified date, time, and era.</summary>
        /// <param name="year">A year. </param>
        /// <param name="month">An integer from 1 through 12 that represents a month. </param>
        /// <param name="day">An integer from 1 through 29 that represents a day. </param>
        /// <param name="hour">An integer from 0 through 23 that represents an hour. </param>
        /// <param name="minute">An integer from 0 through 59 that represents a minute. </param>
        /// <param name="second">An integer from 0 through 59 that represents a second. </param>
        /// <param name="millisecond">An integer from 0 through 999 that represents a millisecond. </param>
        /// <param name="era">An era. Specify <see langword="UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra]" /> or <see cref="F:System.Globalization.UmAlQuraCalendar.UmAlQuraEra" />.</param>
        /// <returns>The <see cref="T:System.DateTime" /> that is set to the specified date and time in the current era.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///         <paramref name="year" />, <paramref name="month" />, <paramref name="day" />, or <paramref name="era" /> is outside the range supported by the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class.-or-
        ///         <paramref name="hour" /> is less than zero or greater than 23.-or-
        ///         <paramref name="minute" /> is less than zero or greater than 59.-or-
        ///         <paramref name="second" /> is less than zero or greater than 59.-or-
        ///         <paramref name="millisecond" /> is less than zero or greater than 999. </exception>
        // Token: 0x06002EE9 RID: 12009 RVA: 0x000B40A4 File Offset: 0x000B22A4
        public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
        {
            if (day >= 1 && day <= 29)
            {
                UmAlQuraCalendar.CheckYearMonthRange(year, month, era);
            }
            else
            {
                int daysInMonth = this.GetDaysInMonth(year, month, era);
                if (day < 1 || day > daysInMonth)
                {
                    throw new ArgumentOutOfRangeException("day", string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Day"), daysInMonth, month));
                }
            }
            long absoluteDateUmAlQura = UmAlQuraCalendar.GetAbsoluteDateUmAlQura(year, month, day);

            if (absoluteDateUmAlQura >= 0L)
            {
                return(new DateTime(absoluteDateUmAlQura * 864000000000L + Calendar.TimeToTicks(hour, minute, second, millisecond)));
            }
            throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"));
        }
コード例 #4
0
 /// <summary>Determines whether the specified month in the specified year and era is a leap month.</summary>
 /// <param name="year">A year. </param>
 /// <param name="month">An integer from 1 through 12 that represents a month. </param>
 /// <param name="era">An era. Specify <see langword="UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra]" /> or <see cref="F:System.Globalization.UmAlQuraCalendar.UmAlQuraEra" />.</param>
 /// <returns>Always <see langword="false" /> because the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class does not support leap months.</returns>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///         <paramref name="year" />, <paramref name="month" />, or <paramref name="era" /> is outside the range supported by the <see cref="T:System.Globalization.UmAlQuraCalendar" /> class. </exception>
 // Token: 0x06002EE7 RID: 12007 RVA: 0x000B407E File Offset: 0x000B227E
 public override bool IsLeapMonth(int year, int month, int era)
 {
     UmAlQuraCalendar.CheckYearMonthRange(year, month, era);
     return(false);
 }