dmy_from_fixed() public static method

The method computes the Julian 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 Julian month. ///
year int The output value giving the Julian year. ///
date int An integer value specifying the fixed day /// number.
return void
コード例 #1
0
        public static int day_from_fixed(int date)
        {
            int result;
            int num;
            int num2;

            CCJulianCalendar.dmy_from_fixed(out result, out num, out num2, date);
            return(result);
        }
コード例 #2
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 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;

            CCJulianCalendar.dmy_from_fixed(out day, out month, out num, date);
            num += years;
            date = CCJulianCalendar.fixed_from_dmy(day, month, num);
            return(CCFixed.ToDateTime(date).Add(time.TimeOfDay));
        }
コード例 #3
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>
        public override DateTime AddYears(DateTime time, int years)
        {
            int rd = CCFixed.FromDateTime(time);
            int day, month, year;

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

            return(t.Add(time.TimeOfDay));
        }
コード例 #4
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 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 -120000.-or- <paramref name="months" /> is greater than 120000. </exception>
        public override DateTime AddMonths(DateTime time, int months)
        {
            int date = CCFixed.FromDateTime(time);
            int day;
            int num;
            int num2;

            CCJulianCalendar.dmy_from_fixed(out day, out num, out num2, date);
            num  += months;
            num2 += CCMath.div_mod(out num, num, 12);
            date  = CCJulianCalendar.fixed_from_dmy(day, num, num2);
            return(CCFixed.ToDateTime(date).Add(time.TimeOfDay));
        }
コード例 #5
0
        /// <summary>
        /// Overridden. 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>
        public override DateTime AddMonths(DateTime time, int months)
        {
            int rd = CCFixed.FromDateTime(time);
            int day, month, year;

            CCJulianCalendar.dmy_from_fixed(
                out day, out month, out year, rd);
            month += months;
            year  += CCMath.div_mod(out month, month, 12);
            rd     = CCJulianCalendar.fixed_from_dmy(day, month, year);
            DateTime t = CCFixed.ToDateTime(rd);

            return(t.Add(time.TimeOfDay));
        }