year_from_fixed() public static méthode

The method computes the Islamic year from a fixed day number.
public static year_from_fixed ( int date ) : int
date int The fixed day number. ///
Résultat int
Exemple #1
0
        /// <summary>
        /// Overridden. Gives the number of the year of the specified
        /// date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the year,
        /// starting with 1.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the
        /// supported range of the Hijri calendar.
        /// </exception>
        public override int GetYear(DateTime time)
        {
            int rd = M_FromDateTime(time);

            M_CheckFixedHijri("time", rd);
            return(CCHijriCalendar.year_from_fixed(rd));
        }
Exemple #2
0
        /// <summary>Calculates the year of a date represented by a specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer that represents the year specified by the <paramref name="time" /> parameter.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. The <see cref="T:System.Globalization.UmAlQuraCalendar" /> class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date).</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is outside the range supported by this calendar. </exception>
        public override int GetYear(DateTime time)
        {
            int num = this.M_FromDateTime(time);

            this.M_CheckFixedHijri("time", num);
            return(CCHijriCalendar.year_from_fixed(num));
        }
        public static void my_from_fixed(out int month, out int year, int date)
        {
            year = CCHijriCalendar.year_from_fixed(date);
            int num = 1 + (int)Math.Ceiling((double)(date - 29 - CCHijriCalendar.fixed_from_dmy(1, 1, year)) / 29.5);

            month = ((num >= 12) ? 12 : num);
        }
Exemple #4
0
        /// <summary>
        /// Overridden. Gives the number of the day in the year.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> that specifies a
        /// date.
        /// </param>
        /// <returns>An integer representing the day of the year,
        /// starting with 1.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> parameter is not in the
        /// supported range of the Hijri calendar.
        /// </exception>
        public override int GetDayOfYear(DateTime time)
        {
            int rd = M_FromDateTime(time);

            M_CheckFixedHijri("time", rd);
            int year  = CCHijriCalendar.year_from_fixed(rd);
            int rd1_1 = CCHijriCalendar.fixed_from_dmy(1, 1, year);

            return(rd - rd1_1 + 1);
        }
Exemple #5
0
        /// <summary>Calculates on which day of the year a specified date occurs.</summary>
        /// <returns>An integer from 1 through 355 that represents the day of the year specified by the <paramref name="time" /> parameter.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. The <see cref="T:System.Globalization.UmAlQuraCalendar" /> class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date).</param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is outside the range supported by this calendar. </exception>
        public override int GetDayOfYear(DateTime time)
        {
            int num = this.M_FromDateTime(time);

            this.M_CheckFixedHijri("time", num);
            int year = CCHijriCalendar.year_from_fixed(num);
            int num2 = CCHijriCalendar.fixed_from_dmy(1, 1, year);

            return(num - num2 + 1);
        }