year_from_fixed() public static method

The method computes the Hebrew year from a fixed day number.
public static year_from_fixed ( int date ) : int
date int The fixed day number. ///
return int
コード例 #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 years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override int GetYear(DateTime time)
        {
            M_CheckDateTime(time);
            int rd = CCFixed.FromDateTime(time);

            return(CCHebrewCalendar.year_from_fixed(rd));
        }
コード例 #2
0
        /// <summary>Returns the year in the specified <see cref="T:System.DateTime" /> value.</summary>
        /// <returns>An integer that represents the year in the specified <see cref="T:System.DateTime" /> value.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is outside the range supported by the current <see cref="T:System.Globalization.HebrewCalendar" /> object. </exception>
        public override int GetYear(DateTime time)
        {
            this.M_CheckDateTime(time);
            int date = CCFixed.FromDateTime(time);

            return(CCHebrewCalendar.year_from_fixed(date));
        }
コード例 #3
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 years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override int GetDayOfYear(DateTime time)
        {
            M_CheckDateTime(time);
            int rd    = CCFixed.FromDateTime(time);
            int year  = CCHebrewCalendar.year_from_fixed(rd);
            int rd1_7 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);

            return(rd - rd1_7 + 1);
        }
コード例 #4
0
        /// <summary>Returns the day of the year in the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>An integer from 1 to 385 that represents the day of the year in the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="time" /> is earlier than September 17, 1583 in the Gregorian calendar, or greater than <see cref="P:System.Globalization.HebrewCalendar.MaxSupportedDateTime" />. </exception>
        public override int GetDayOfYear(DateTime time)
        {
            this.M_CheckDateTime(time);
            int num  = CCFixed.FromDateTime(time);
            int year = CCHebrewCalendar.year_from_fixed(num);
            int num2 = CCHebrewCalendar.fixed_from_dmy(1, 7, year);

            return(num - num2 + 1);
        }
コード例 #5
0
        public static void my_from_fixed(out int month, out int year, int date)
        {
            year = CCHebrewCalendar.year_from_fixed(date);
            int num = (date >= CCHebrewCalendar.fixed_from_dmy(1, 1, year)) ? 1 : 7;

            month = num;
            while (date > CCHebrewCalendar.fixed_from_dmy(CCHebrewCalendar.last_day_of_month(month, year), month, year))
            {
                month++;
            }
        }