HandCoded.Finance.Date.Plus C# (CSharp) Method

Plus() public method

Creates a new Date based on the current instance and a given Interval.
public Plus ( Interval interval ) : Date
interval Interval The time .
return Date
        public Date Plus(Interval interval)
        {
            return (new Date (dateValue.Plus (interval), timeZone));
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Tests if the payment date falls on a calculated date.
        /// </summary>
        /// <param name="paymentDate">The payment date.</param>
        /// <param name="startDate">The calculation period start date.</param>
        /// <param name="endDate">The calculation perion end date.</param>
        /// <param name="freq">	The period frequency.</param>
        /// <returns><c>true</c> if the payment date falls on a calculated date.</returns>
        private static bool IsUnadjustedCalculationPeriodDate(Date paymentDate, Date startDate, Date endDate, Interval freq)
        {
            Interval	step = new Interval (0, Period.DAY);

            for (;;) {
                Date		targetDate = startDate.Plus (step);

                if (targetDate.CompareTo (endDate) > 0) return (false);
                if (targetDate.Equals (paymentDate)) return (true);

                step = step.Plus (freq);
            }
        }