dmy_from_fixed() 공개 정적인 메소드

The method computes the Hebrew year, month, and day from a fixed day number.
public static dmy_from_fixed ( int &day, int &month, int &year, int date ) : void
day int The output value returning the day of the /// month. ///
month int The output value giving the Hebrew month. ///
year int The output value giving the Hebrew year. ///
date int An integer value specifying the fixed day /// number.
리턴 void
예제 #1
0
        public static int day_from_fixed(int date)
        {
            int result;
            int num;
            int num2;

            CCHebrewCalendar.dmy_from_fixed(out result, out num, out num2, date);
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Overrideden. Adds months to a given date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> to which to add
        /// months.
        /// </param>
        /// <param name="months">The number of months to add.</param>
        /// <returns>A new <see cref="T:System.DateTime"/> value, that
        /// results from adding <paramref name="months"/> to the specified
        /// DateTime.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> return value is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override DateTime AddMonths(DateTime time, int months)
        {
            int      y, m, d;
            DateTime t;

            if (months == 0)
            {
                t = time;
            }
            else
            {
                int rd = CCFixed.FromDateTime(time);
                CCHebrewCalendar.dmy_from_fixed(
                    out d, out m, out y, rd);
                m = M_Month(m, y);
                if (months < 0)
                {
                    while (months < 0)
                    {
                        if (m + months > 0)
                        {
                            m     += months;
                            months = 0;
                        }
                        else
                        {
                            months += m;
                            y      -= 1;
                            m       = GetMonthsInYear(y);
                        }
                    }
                }
                else
                {
                    while (months > 0)
                    {
                        int my = GetMonthsInYear(y);
                        if (m + months <= my)
                        {
                            m     += months;
                            months = 0;
                        }
                        else
                        {
                            months -= my - m + 1;
                            m       = 1;
                            y      += 1;
                        }
                    }
                }
                t = ToDateTime(y, m, d, 0, 0, 0, 0);
                t = t.Add(time.TimeOfDay);
            }
            M_CheckDateTime(t);
            return(t);
        }
예제 #3
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of months away from the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of months to the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to which to add <paramref name="months" />. </param>
        /// <param name="months">The number of months to add. </param>
        /// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="months" /> is less than -120,000 or greater than 120,000. </exception>
        public override DateTime AddMonths(DateTime time, int months)
        {
            DateTime dateTime;

            if (months == 0)
            {
                dateTime = time;
            }
            else
            {
                int date = CCFixed.FromDateTime(time);
                int day;
                int num;
                int num2;
                CCHebrewCalendar.dmy_from_fixed(out day, out num, out num2, date);
                num = this.M_Month(num, num2);
                if (months < 0)
                {
                    while (months < 0)
                    {
                        if (num + months > 0)
                        {
                            num   += months;
                            months = 0;
                        }
                        else
                        {
                            months += num;
                            num2--;
                            num = this.GetMonthsInYear(num2);
                        }
                    }
                }
                else
                {
                    while (months > 0)
                    {
                        int monthsInYear = this.GetMonthsInYear(num2);
                        if (num + months <= monthsInYear)
                        {
                            num   += months;
                            months = 0;
                        }
                        else
                        {
                            months -= monthsInYear - num + 1;
                            num     = 1;
                            num2++;
                        }
                    }
                }
                dateTime = this.ToDateTime(num2, num, day, 0, 0, 0, 0).Add(time.TimeOfDay);
            }
            this.M_CheckDateTime(dateTime);
            return(dateTime);
        }
예제 #4
0
        /// <summary>
        /// Overridden. Adds years to a given date.
        /// </summary>
        /// <param name="time">The
        /// <see cref="T:System.DateTime"/> to which to add
        /// years.
        /// </param>
        /// <param name="years">The number of years to add.</param>
        /// <returns>A new <see cref="T:System.DateTime"/> value, that
        /// results from adding <paramref name="years"/> to the specified
        /// DateTime.</returns>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        /// The exception is thrown if the
        /// <see cref="T:System.DateTime"/> return value is not in the years
        /// between 5343 A.M. and 6000 A.M., inclusive.
        /// </exception>
        public override DateTime AddYears(DateTime time, int years)
        {
            int rd = CCFixed.FromDateTime(time);
            int day, month, year;

            CCHebrewCalendar.dmy_from_fixed(
                out day, out month, out year, rd);
            year += years;
            rd    = CCHebrewCalendar.fixed_from_dmy(day, month, year);
            DateTime t = CCFixed.ToDateTime(rd);

            t = t.Add(time.TimeOfDay);
            M_CheckDateTime(t);
            return(t);
        }
예제 #5
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of years away from the specified <see cref="T:System.DateTime" />.</summary>
        /// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of years to the specified <see cref="T:System.DateTime" />.</returns>
        /// <param name="time">The <see cref="T:System.DateTime" /> to which to add <paramref name="years" />. </param>
        /// <param name="years">The number of years to add. </param>
        /// <exception cref="T:System.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
        public override DateTime AddYears(DateTime time, int years)
        {
            int date = CCFixed.FromDateTime(time);
            int day;
            int month;
            int num;

            CCHebrewCalendar.dmy_from_fixed(out day, out month, out num, date);
            num += years;
            date = CCHebrewCalendar.fixed_from_dmy(day, month, num);
            DateTime dateTime = CCFixed.ToDateTime(date).Add(time.TimeOfDay);

            this.M_CheckDateTime(dateTime);
            return(dateTime);
        }