Пример #1
0
        /// <summary>
        /// Return a new date with the <paramref name="tenor"/> added to it.
        /// </summary>
        /// <param name="tenor">The amount of time to add to the date.</param>
        /// <returns></returns>
        public Date AddTenor(Tenor tenor)
        {
            var newDate = date.AddYears(tenor.Years);

            newDate = newDate.AddMonths(tenor.Months);
            newDate = newDate.AddDays(tenor.Weeks * 7 + tenor.Days);
            return(new Date(newDate));
        }
Пример #2
0
        public Date SubtractTenor(Tenor tenor)
        {
            var newdate = date.AddYears(tenor.Years * -1);

            newdate = newdate.AddMonths(tenor.Months * -1);
            newdate = newdate.AddDays(tenor.Weeks * -7 + tenor.Days);
            return(new Date(newdate));
        }